Contents of /trunk/kernel26-xen/patches-2.6.25-r1/0101-2.6.25.2-all-fixes.patch
Parent Directory | Revision Log
Revision 606 -
(show annotations)
(download)
Thu May 22 23:13:13 2008 UTC (16 years, 4 months ago) by niro
File size: 1594 byte(s)
Thu May 22 23:13:13 2008 UTC (16 years, 4 months ago) by niro
File size: 1594 byte(s)
-ver bump to 2.6.25-magellan-r1: - linux-2.6.25.4 - fbcondecor-0.9.4 - squashfs-3.3 - unionfs-2.3.3 - tuxonice-3.0-rc7 - linux-phc-0.3.0 - acpi-dstd-0.9a - reiser4 - xen-3.2.0 . ipw3945-1.2.2
1 | diff --git a/fs/locks.c b/fs/locks.c |
2 | index 43c0af2..159e0f6 100644 |
3 | --- a/fs/locks.c |
4 | +++ b/fs/locks.c |
5 | @@ -1750,6 +1750,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, |
6 | struct file_lock *file_lock = locks_alloc_lock(); |
7 | struct flock flock; |
8 | struct inode *inode; |
9 | + struct file *f; |
10 | int error; |
11 | |
12 | if (file_lock == NULL) |
13 | @@ -1822,7 +1823,15 @@ again: |
14 | * Attempt to detect a close/fcntl race and recover by |
15 | * releasing the lock that was just acquired. |
16 | */ |
17 | - if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) { |
18 | + /* |
19 | + * we need that spin_lock here - it prevents reordering between |
20 | + * update of inode->i_flock and check for it done in close(). |
21 | + * rcu_read_lock() wouldn't do. |
22 | + */ |
23 | + spin_lock(¤t->files->file_lock); |
24 | + f = fcheck(fd); |
25 | + spin_unlock(¤t->files->file_lock); |
26 | + if (!error && f != filp && flock.l_type != F_UNLCK) { |
27 | flock.l_type = F_UNLCK; |
28 | goto again; |
29 | } |
30 | @@ -1878,6 +1887,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, |
31 | struct file_lock *file_lock = locks_alloc_lock(); |
32 | struct flock64 flock; |
33 | struct inode *inode; |
34 | + struct file *f; |
35 | int error; |
36 | |
37 | if (file_lock == NULL) |
38 | @@ -1950,7 +1960,10 @@ again: |
39 | * Attempt to detect a close/fcntl race and recover by |
40 | * releasing the lock that was just acquired. |
41 | */ |
42 | - if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) { |
43 | + spin_lock(¤t->files->file_lock); |
44 | + f = fcheck(fd); |
45 | + spin_unlock(¤t->files->file_lock); |
46 | + if (!error && f != filp && flock.l_type != F_UNLCK) { |
47 | flock.l_type = F_UNLCK; |
48 | goto again; |
49 | } |