diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-10 23:04:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-10 23:04:59 -0400 |
commit | cf596766fc53bbfa0e2b21e3569932aa54f5f9ca (patch) | |
tree | 6e88bae48c06f5b4a099989abb04178b939d2b24 /fs/nfsd | |
parent | 516f7b3f2a7dbe93d3075e76a06bbfcd0c0ee4f7 (diff) | |
parent | d4a516560fc96a9d486a9939bcb567e3fdce8f49 (diff) |
Merge branch 'nfsd-next' of git://linux-nfs.org/~bfields/linux
Pull nfsd updates from Bruce Fields:
"This was a very quiet cycle! Just a few bugfixes and some cleanup"
* 'nfsd-next' of git://linux-nfs.org/~bfields/linux:
rpc: let xdr layer allocate gssproxy receieve pages
rpc: fix huge kmalloc's in gss-proxy
rpc: comment on linux_cred encoding, treat all as unsigned
rpc: clean up decoding of gssproxy linux creds
svcrpc: remove unused rq_resused
nfsd4: nfsd4_create_clid_dir prints uninitialized data
nfsd4: fix leak of inode reference on delegation failure
Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR"
sunrpc: prepare NFS for 2038
nfsd4: fix setlease error return
nfsd: nfs4_file_get_access: need to be more careful with O_RDWR
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4recover.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 33 |
2 files changed, 21 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 105a3b080d12..e0a65a9e37e9 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -173,8 +173,6 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) | |||
173 | int status; | 173 | int status; |
174 | struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); | 174 | struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); |
175 | 175 | ||
176 | dprintk("NFSD: nfsd4_create_clid_dir for \"%s\"\n", dname); | ||
177 | |||
178 | if (test_and_set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags)) | 176 | if (test_and_set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags)) |
179 | return; | 177 | return; |
180 | if (!nn->rec_file) | 178 | if (!nn->rec_file) |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 43f42290e5df..0874998a49cd 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -368,11 +368,8 @@ static struct nfs4_delegation * | |||
368 | alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct svc_fh *current_fh) | 368 | alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct svc_fh *current_fh) |
369 | { | 369 | { |
370 | struct nfs4_delegation *dp; | 370 | struct nfs4_delegation *dp; |
371 | struct nfs4_file *fp = stp->st_file; | ||
372 | 371 | ||
373 | dprintk("NFSD alloc_init_deleg\n"); | 372 | dprintk("NFSD alloc_init_deleg\n"); |
374 | if (fp->fi_had_conflict) | ||
375 | return NULL; | ||
376 | if (num_delegations > max_delegations) | 373 | if (num_delegations > max_delegations) |
377 | return NULL; | 374 | return NULL; |
378 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); | 375 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); |
@@ -389,8 +386,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct sv | |||
389 | INIT_LIST_HEAD(&dp->dl_perfile); | 386 | INIT_LIST_HEAD(&dp->dl_perfile); |
390 | INIT_LIST_HEAD(&dp->dl_perclnt); | 387 | INIT_LIST_HEAD(&dp->dl_perclnt); |
391 | INIT_LIST_HEAD(&dp->dl_recall_lru); | 388 | INIT_LIST_HEAD(&dp->dl_recall_lru); |
392 | get_nfs4_file(fp); | 389 | dp->dl_file = NULL; |
393 | dp->dl_file = fp; | ||
394 | dp->dl_type = NFS4_OPEN_DELEGATE_READ; | 390 | dp->dl_type = NFS4_OPEN_DELEGATE_READ; |
395 | fh_copy_shallow(&dp->dl_fh, ¤t_fh->fh_handle); | 391 | fh_copy_shallow(&dp->dl_fh, ¤t_fh->fh_handle); |
396 | dp->dl_time = 0; | 392 | dp->dl_time = 0; |
@@ -3035,7 +3031,7 @@ static int nfs4_setlease(struct nfs4_delegation *dp) | |||
3035 | if (status) { | 3031 | if (status) { |
3036 | list_del_init(&dp->dl_perclnt); | 3032 | list_del_init(&dp->dl_perclnt); |
3037 | locks_free_lock(fl); | 3033 | locks_free_lock(fl); |
3038 | return -ENOMEM; | 3034 | return status; |
3039 | } | 3035 | } |
3040 | fp->fi_lease = fl; | 3036 | fp->fi_lease = fl; |
3041 | fp->fi_deleg_file = get_file(fl->fl_file); | 3037 | fp->fi_deleg_file = get_file(fl->fl_file); |
@@ -3044,22 +3040,35 @@ static int nfs4_setlease(struct nfs4_delegation *dp) | |||
3044 | return 0; | 3040 | return 0; |
3045 | } | 3041 | } |
3046 | 3042 | ||
3047 | static int nfs4_set_delegation(struct nfs4_delegation *dp) | 3043 | static int nfs4_set_delegation(struct nfs4_delegation *dp, struct nfs4_file *fp) |
3048 | { | 3044 | { |
3049 | struct nfs4_file *fp = dp->dl_file; | 3045 | int status; |
3050 | 3046 | ||
3051 | if (!fp->fi_lease) | 3047 | if (fp->fi_had_conflict) |
3052 | return nfs4_setlease(dp); | 3048 | return -EAGAIN; |
3049 | get_nfs4_file(fp); | ||
3050 | dp->dl_file = fp; | ||
3051 | if (!fp->fi_lease) { | ||
3052 | status = nfs4_setlease(dp); | ||
3053 | if (status) | ||
3054 | goto out_free; | ||
3055 | return 0; | ||
3056 | } | ||
3053 | spin_lock(&recall_lock); | 3057 | spin_lock(&recall_lock); |
3054 | if (fp->fi_had_conflict) { | 3058 | if (fp->fi_had_conflict) { |
3055 | spin_unlock(&recall_lock); | 3059 | spin_unlock(&recall_lock); |
3056 | return -EAGAIN; | 3060 | status = -EAGAIN; |
3061 | goto out_free; | ||
3057 | } | 3062 | } |
3058 | atomic_inc(&fp->fi_delegees); | 3063 | atomic_inc(&fp->fi_delegees); |
3059 | list_add(&dp->dl_perfile, &fp->fi_delegations); | 3064 | list_add(&dp->dl_perfile, &fp->fi_delegations); |
3060 | spin_unlock(&recall_lock); | 3065 | spin_unlock(&recall_lock); |
3061 | list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations); | 3066 | list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations); |
3062 | return 0; | 3067 | return 0; |
3068 | out_free: | ||
3069 | put_nfs4_file(fp); | ||
3070 | dp->dl_file = fp; | ||
3071 | return status; | ||
3063 | } | 3072 | } |
3064 | 3073 | ||
3065 | static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) | 3074 | static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) |
@@ -3134,7 +3143,7 @@ nfs4_open_delegation(struct net *net, struct svc_fh *fh, | |||
3134 | dp = alloc_init_deleg(oo->oo_owner.so_client, stp, fh); | 3143 | dp = alloc_init_deleg(oo->oo_owner.so_client, stp, fh); |
3135 | if (dp == NULL) | 3144 | if (dp == NULL) |
3136 | goto out_no_deleg; | 3145 | goto out_no_deleg; |
3137 | status = nfs4_set_delegation(dp); | 3146 | status = nfs4_set_delegation(dp, stp->st_file); |
3138 | if (status) | 3147 | if (status) |
3139 | goto out_free; | 3148 | goto out_free; |
3140 | 3149 | ||