diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-09-30 17:21:41 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-09-30 17:21:41 -0400 |
commit | 72c23f0819977d37924af92a42a9b7fbfd1c95d8 (patch) | |
tree | a0c10114d96c40f8e38887c346ec593a51321781 /fs/nfs/nfs4proc.c | |
parent | 3fc3edf141fd78f624194eb89d7b37ff86138422 (diff) | |
parent | d1f456b0b9545f1606a54cd17c20775f159bd2ce (diff) |
Merge branch 'bugfixes' into linux-next
* bugfixes:
NFSv4.1: Fix an NFSv4.1 state renewal regression
NFSv4: fix open/lock state recovery error handling
NFSv4: Fix lock recovery when CREATE_SESSION/SETCLIENTID_CONFIRM fails
NFS: Fabricate fscache server index key correctly
SUNRPC: Add missing support for RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT
nfs: fix duplicate proc entries
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 45bce9ed6791..5aa55c132aa2 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2234,9 +2234,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
2234 | ret = _nfs4_proc_open(opendata); | 2234 | ret = _nfs4_proc_open(opendata); |
2235 | if (ret != 0) { | 2235 | if (ret != 0) { |
2236 | if (ret == -ENOENT) { | 2236 | if (ret == -ENOENT) { |
2237 | d_drop(opendata->dentry); | 2237 | dentry = opendata->dentry; |
2238 | d_add(opendata->dentry, NULL); | 2238 | if (dentry->d_inode) |
2239 | nfs_set_verifier(opendata->dentry, | 2239 | d_delete(dentry); |
2240 | else if (d_unhashed(dentry)) | ||
2241 | d_add(dentry, NULL); | ||
2242 | |||
2243 | nfs_set_verifier(dentry, | ||
2240 | nfs_save_change_attribute(opendata->dir->d_inode)); | 2244 | nfs_save_change_attribute(opendata->dir->d_inode)); |
2241 | } | 2245 | } |
2242 | goto out; | 2246 | goto out; |
@@ -2622,23 +2626,23 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2622 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); | 2626 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); |
2623 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); | 2627 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); |
2624 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); | 2628 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); |
2625 | /* Calculate the current open share mode */ | ||
2626 | calldata->arg.fmode = 0; | ||
2627 | if (is_rdonly || is_rdwr) | ||
2628 | calldata->arg.fmode |= FMODE_READ; | ||
2629 | if (is_wronly || is_rdwr) | ||
2630 | calldata->arg.fmode |= FMODE_WRITE; | ||
2631 | /* Calculate the change in open mode */ | 2629 | /* Calculate the change in open mode */ |
2630 | calldata->arg.fmode = 0; | ||
2632 | if (state->n_rdwr == 0) { | 2631 | if (state->n_rdwr == 0) { |
2633 | if (state->n_rdonly == 0) { | 2632 | if (state->n_rdonly == 0) |
2634 | call_close |= is_rdonly || is_rdwr; | 2633 | call_close |= is_rdonly; |
2635 | calldata->arg.fmode &= ~FMODE_READ; | 2634 | else if (is_rdonly) |
2636 | } | 2635 | calldata->arg.fmode |= FMODE_READ; |
2637 | if (state->n_wronly == 0) { | 2636 | if (state->n_wronly == 0) |
2638 | call_close |= is_wronly || is_rdwr; | 2637 | call_close |= is_wronly; |
2639 | calldata->arg.fmode &= ~FMODE_WRITE; | 2638 | else if (is_wronly) |
2640 | } | 2639 | calldata->arg.fmode |= FMODE_WRITE; |
2641 | } | 2640 | } else if (is_rdwr) |
2641 | calldata->arg.fmode |= FMODE_READ|FMODE_WRITE; | ||
2642 | |||
2643 | if (calldata->arg.fmode == 0) | ||
2644 | call_close |= is_rdwr; | ||
2645 | |||
2642 | if (!nfs4_valid_open_stateid(state)) | 2646 | if (!nfs4_valid_open_stateid(state)) |
2643 | call_close = 0; | 2647 | call_close = 0; |
2644 | spin_unlock(&state->owner->so_lock); | 2648 | spin_unlock(&state->owner->so_lock); |
@@ -7368,7 +7372,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cr | |||
7368 | int ret = 0; | 7372 | int ret = 0; |
7369 | 7373 | ||
7370 | if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0) | 7374 | if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0) |
7371 | return 0; | 7375 | return -EAGAIN; |
7372 | task = _nfs41_proc_sequence(clp, cred, false); | 7376 | task = _nfs41_proc_sequence(clp, cred, false); |
7373 | if (IS_ERR(task)) | 7377 | if (IS_ERR(task)) |
7374 | ret = PTR_ERR(task); | 7378 | ret = PTR_ERR(task); |