Magellan Linux

Annotation of /trunk/kernel26-magellan/patches-2.6.24-r7/0106-2.6.24.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 589 - (hide annotations) (download)
Fri May 9 12:49:26 2008 UTC (16 years ago) by niro
File size: 1594 byte(s)
-2.6.24-magellan-r7; updated to linux-2.6.24.7

1 niro 589 diff --git a/fs/locks.c b/fs/locks.c
2     index 2fd29d9..7127620 100644
3     --- a/fs/locks.c
4     +++ b/fs/locks.c
5     @@ -1754,6 +1754,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     @@ -1826,7 +1827,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(&current->files->file_lock);
24     + f = fcheck(fd);
25     + spin_unlock(&current->files->file_lock);
26     + if (!error && f != filp && flock.l_type != F_UNLCK) {
27     flock.l_type = F_UNLCK;
28     goto again;
29     }
30     @@ -1882,6 +1891,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     @@ -1954,7 +1964,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(&current->files->file_lock);
44     + f = fcheck(fd);
45     + spin_unlock(&current->files->file_lock);
46     + if (!error && f != filp && flock.l_type != F_UNLCK) {
47     flock.l_type = F_UNLCK;
48     goto again;
49     }