diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-06-17 21:13:00 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-06-18 21:13:44 -0400 |
commit | 1f84603c0940d5bed17f7e4d2e0b2a4b8b8f1b81 (patch) | |
tree | 143956f878290e85de7c9130f465e862f587ee53 /fs/nfs/nfs4state.c | |
parent | 301933a0acfdec837fd8b4884093b3f0fff01d8a (diff) | |
parent | 4bf259e3ae5015e73282ba66716c4a917e1264ac (diff) |
Merge branch 'devel-for-2.6.31' into for-2.6.31
Conflicts:
fs/nfs/client.c
fs/nfs/super.c
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 2cfca9929c9a..b73c5a728655 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -853,32 +853,45 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_ | |||
853 | struct file_lock *fl; | 853 | struct file_lock *fl; |
854 | int status = 0; | 854 | int status = 0; |
855 | 855 | ||
856 | if (inode->i_flock == NULL) | ||
857 | return 0; | ||
858 | |||
859 | /* Guard against delegation returns and new lock/unlock calls */ | ||
856 | down_write(&nfsi->rwsem); | 860 | down_write(&nfsi->rwsem); |
861 | /* Protect inode->i_flock using the BKL */ | ||
862 | lock_kernel(); | ||
857 | for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { | 863 | for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { |
858 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) | 864 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) |
859 | continue; | 865 | continue; |
860 | if (nfs_file_open_context(fl->fl_file)->state != state) | 866 | if (nfs_file_open_context(fl->fl_file)->state != state) |
861 | continue; | 867 | continue; |
868 | unlock_kernel(); | ||
862 | status = ops->recover_lock(state, fl); | 869 | status = ops->recover_lock(state, fl); |
863 | if (status >= 0) | ||
864 | continue; | ||
865 | switch (status) { | 870 | switch (status) { |
871 | case 0: | ||
872 | break; | ||
873 | case -ESTALE: | ||
874 | case -NFS4ERR_ADMIN_REVOKED: | ||
875 | case -NFS4ERR_STALE_STATEID: | ||
876 | case -NFS4ERR_BAD_STATEID: | ||
877 | case -NFS4ERR_EXPIRED: | ||
878 | case -NFS4ERR_NO_GRACE: | ||
879 | case -NFS4ERR_STALE_CLIENTID: | ||
880 | goto out; | ||
866 | default: | 881 | default: |
867 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", | 882 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", |
868 | __func__, status); | 883 | __func__, status); |
869 | case -NFS4ERR_EXPIRED: | 884 | case -ENOMEM: |
870 | case -NFS4ERR_NO_GRACE: | 885 | case -NFS4ERR_DENIED: |
871 | case -NFS4ERR_RECLAIM_BAD: | 886 | case -NFS4ERR_RECLAIM_BAD: |
872 | case -NFS4ERR_RECLAIM_CONFLICT: | 887 | case -NFS4ERR_RECLAIM_CONFLICT: |
873 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | 888 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
874 | break; | 889 | status = 0; |
875 | case -NFS4ERR_STALE_CLIENTID: | ||
876 | goto out_err; | ||
877 | } | 890 | } |
891 | lock_kernel(); | ||
878 | } | 892 | } |
879 | up_write(&nfsi->rwsem); | 893 | unlock_kernel(); |
880 | return 0; | 894 | out: |
881 | out_err: | ||
882 | up_write(&nfsi->rwsem); | 895 | up_write(&nfsi->rwsem); |
883 | return status; | 896 | return status; |
884 | } | 897 | } |
@@ -924,6 +937,7 @@ restart: | |||
924 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", | 937 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", |
925 | __func__, status); | 938 | __func__, status); |
926 | case -ENOENT: | 939 | case -ENOENT: |
940 | case -ENOMEM: | ||
927 | case -ESTALE: | 941 | case -ESTALE: |
928 | /* | 942 | /* |
929 | * Open state on this file cannot be recovered | 943 | * Open state on this file cannot be recovered |
@@ -934,6 +948,9 @@ restart: | |||
934 | /* Mark the file as being 'closed' */ | 948 | /* Mark the file as being 'closed' */ |
935 | state->state = 0; | 949 | state->state = 0; |
936 | break; | 950 | break; |
951 | case -NFS4ERR_ADMIN_REVOKED: | ||
952 | case -NFS4ERR_STALE_STATEID: | ||
953 | case -NFS4ERR_BAD_STATEID: | ||
937 | case -NFS4ERR_RECLAIM_BAD: | 954 | case -NFS4ERR_RECLAIM_BAD: |
938 | case -NFS4ERR_RECLAIM_CONFLICT: | 955 | case -NFS4ERR_RECLAIM_CONFLICT: |
939 | nfs4_state_mark_reclaim_nograce(sp->so_client, state); | 956 | nfs4_state_mark_reclaim_nograce(sp->so_client, state); |