diff options
| author | Wu Fengguang <[email protected]> | 2010-03-05 21:42:01 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2010-03-06 19:26:25 +0000 |
| commit | 42e49608683ab25fbbbf9c40edb944601e543882 (patch) | |
| tree | 5cc8beee91f235cdaf6be986f90275e04137c2bc /fs/file_table.c | |
| parent | mm/migrate.c: kill anon local variable from migrate_page_copy (diff) | |
| download | kernel-42e49608683ab25fbbbf9c40edb944601e543882.tar.gz kernel-42e49608683ab25fbbbf9c40edb944601e543882.zip | |
vfs: take f_lock on modifying f_mode after open time
We'll introduce FMODE_RANDOM which will be runtime modified. So protect
all runtime modification to f_mode with f_lock to avoid races.
Signed-off-by: Wu Fengguang <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Trond Myklebust <[email protected]>
Cc: Chuck Lever <[email protected]>
Cc: <[email protected]> [2.6.33.x]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/file_table.c')
| -rw-r--r-- | fs/file_table.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index b98404b54383..32d12b78bac8 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -393,7 +393,9 @@ retry: continue; if (!(f->f_mode & FMODE_WRITE)) continue; + spin_lock(&f->f_lock); f->f_mode &= ~FMODE_WRITE; + spin_unlock(&f->f_lock); if (file_check_writeable(f) != 0) continue; file_release_write(f); |
