diff options
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 6e094e95cf0f..0b2a19bfe5a0 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -847,12 +847,19 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_ | |||
847 | struct file_lock *fl; | 847 | struct file_lock *fl; |
848 | int status = 0; | 848 | int status = 0; |
849 | 849 | ||
850 | if (inode->i_flock == NULL) | ||
851 | return 0; | ||
852 | |||
853 | /* Guard against delegation returns and new lock/unlock calls */ | ||
850 | down_write(&nfsi->rwsem); | 854 | down_write(&nfsi->rwsem); |
855 | /* Protect inode->i_flock using the BKL */ | ||
856 | lock_kernel(); | ||
851 | for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { | 857 | for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { |
852 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) | 858 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) |
853 | continue; | 859 | continue; |
854 | if (nfs_file_open_context(fl->fl_file)->state != state) | 860 | if (nfs_file_open_context(fl->fl_file)->state != state) |
855 | continue; | 861 | continue; |
862 | unlock_kernel(); | ||
856 | status = ops->recover_lock(state, fl); | 863 | status = ops->recover_lock(state, fl); |
857 | switch (status) { | 864 | switch (status) { |
858 | case 0: | 865 | case 0: |
@@ -875,7 +882,9 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_ | |||
875 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | 882 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
876 | status = 0; | 883 | status = 0; |
877 | } | 884 | } |
885 | lock_kernel(); | ||
878 | } | 886 | } |
887 | unlock_kernel(); | ||
879 | out: | 888 | out: |
880 | up_write(&nfsi->rwsem); | 889 | up_write(&nfsi->rwsem); |
881 | return status; | 890 | return status; |