diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-26 17:25:48 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-26 17:25:48 -0400 |
| commit | 14c741de93861749dfb60b4964028541f5c506ca (patch) | |
| tree | d74dd762817f11837113677429696e66cdc7eb41 | |
| parent | 65ae689329c5d6a149b9201df9321368fbdb6a5c (diff) | |
| parent | 01f2f5b82a2b523ae76af53f2ff43c48dde10a00 (diff) | |
Merge tag 'nfs-for-5.1-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes from Trond Myklebust:
"Highlights include:
Stable fixes:
- Fix nfs4_lock_state refcounting in nfs4_alloc_{lock,unlock}data()
- fix mount/umount race in nlmclnt.
- NFSv4.1 don't free interrupted slot on open
Bugfixes:
- Don't let RPC_SOFTCONN tasks time out if the transport is connected
- Fix a typo in nfs_init_timeout_values()
- Fix layoutstats handling during read failovers
- fix uninitialized variable warning"
* tag 'nfs-for-5.1-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
SUNRPC: fix uninitialized variable warning
pNFS/flexfiles: Fix layoutstats handling during read failovers
NFS: Fix a typo in nfs_init_timeout_values()
SUNRPC: Don't let RPC_SOFTCONN tasks time out if the transport is connected
NFSv4.1 don't free interrupted slot on open
NFS: fix mount/umount race in nlmclnt.
NFS: Fix nfs4_lock_state refcounting in nfs4_alloc_{lock,unlock}data()
| -rw-r--r-- | fs/lockd/host.c | 3 | ||||
| -rw-r--r-- | fs/nfs/client.c | 2 | ||||
| -rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.c | 5 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 5 | ||||
| -rw-r--r-- | net/sunrpc/clnt.c | 12 | ||||
| -rw-r--r-- | net/sunrpc/xprtsock.c | 4 |
6 files changed, 21 insertions, 10 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 93fb7cf0b92b..f0b5c987d6ae 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -290,12 +290,11 @@ void nlmclnt_release_host(struct nlm_host *host) | |||
| 290 | 290 | ||
| 291 | WARN_ON_ONCE(host->h_server); | 291 | WARN_ON_ONCE(host->h_server); |
| 292 | 292 | ||
| 293 | if (refcount_dec_and_test(&host->h_count)) { | 293 | if (refcount_dec_and_mutex_lock(&host->h_count, &nlm_host_mutex)) { |
| 294 | WARN_ON_ONCE(!list_empty(&host->h_lockowners)); | 294 | WARN_ON_ONCE(!list_empty(&host->h_lockowners)); |
| 295 | WARN_ON_ONCE(!list_empty(&host->h_granted)); | 295 | WARN_ON_ONCE(!list_empty(&host->h_granted)); |
| 296 | WARN_ON_ONCE(!list_empty(&host->h_reclaim)); | 296 | WARN_ON_ONCE(!list_empty(&host->h_reclaim)); |
| 297 | 297 | ||
| 298 | mutex_lock(&nlm_host_mutex); | ||
| 299 | nlm_destroy_host_locked(host); | 298 | nlm_destroy_host_locked(host); |
| 300 | mutex_unlock(&nlm_host_mutex); | 299 | mutex_unlock(&nlm_host_mutex); |
| 301 | } | 300 | } |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index fb1cf1a4bda2..90d71fda65ce 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
| @@ -453,7 +453,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto, | |||
| 453 | case XPRT_TRANSPORT_RDMA: | 453 | case XPRT_TRANSPORT_RDMA: |
| 454 | if (retrans == NFS_UNSPEC_RETRANS) | 454 | if (retrans == NFS_UNSPEC_RETRANS) |
| 455 | to->to_retries = NFS_DEF_TCP_RETRANS; | 455 | to->to_retries = NFS_DEF_TCP_RETRANS; |
| 456 | if (timeo == NFS_UNSPEC_TIMEO || to->to_retries == 0) | 456 | if (timeo == NFS_UNSPEC_TIMEO || to->to_initval == 0) |
| 457 | to->to_initval = NFS_DEF_TCP_TIMEO * HZ / 10; | 457 | to->to_initval = NFS_DEF_TCP_TIMEO * HZ / 10; |
| 458 | if (to->to_initval > NFS_MAX_TCP_TIMEOUT) | 458 | if (to->to_initval > NFS_MAX_TCP_TIMEOUT) |
| 459 | to->to_initval = NFS_MAX_TCP_TIMEOUT; | 459 | to->to_initval = NFS_MAX_TCP_TIMEOUT; |
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index f9264e1922a2..6673d4ff5a2a 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c | |||
| @@ -1289,6 +1289,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, | |||
| 1289 | static int ff_layout_read_done_cb(struct rpc_task *task, | 1289 | static int ff_layout_read_done_cb(struct rpc_task *task, |
| 1290 | struct nfs_pgio_header *hdr) | 1290 | struct nfs_pgio_header *hdr) |
| 1291 | { | 1291 | { |
| 1292 | int new_idx = hdr->pgio_mirror_idx; | ||
| 1292 | int err; | 1293 | int err; |
| 1293 | 1294 | ||
| 1294 | trace_nfs4_pnfs_read(hdr, task->tk_status); | 1295 | trace_nfs4_pnfs_read(hdr, task->tk_status); |
| @@ -1307,7 +1308,7 @@ static int ff_layout_read_done_cb(struct rpc_task *task, | |||
| 1307 | case -NFS4ERR_RESET_TO_PNFS: | 1308 | case -NFS4ERR_RESET_TO_PNFS: |
| 1308 | if (ff_layout_choose_best_ds_for_read(hdr->lseg, | 1309 | if (ff_layout_choose_best_ds_for_read(hdr->lseg, |
| 1309 | hdr->pgio_mirror_idx + 1, | 1310 | hdr->pgio_mirror_idx + 1, |
| 1310 | &hdr->pgio_mirror_idx)) | 1311 | &new_idx)) |
| 1311 | goto out_layouterror; | 1312 | goto out_layouterror; |
| 1312 | set_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); | 1313 | set_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); |
| 1313 | return task->tk_status; | 1314 | return task->tk_status; |
| @@ -1320,7 +1321,9 @@ static int ff_layout_read_done_cb(struct rpc_task *task, | |||
| 1320 | 1321 | ||
| 1321 | return 0; | 1322 | return 0; |
| 1322 | out_layouterror: | 1323 | out_layouterror: |
| 1324 | ff_layout_read_record_layoutstats_done(task, hdr); | ||
| 1323 | ff_layout_send_layouterror(hdr->lseg); | 1325 | ff_layout_send_layouterror(hdr->lseg); |
| 1326 | hdr->pgio_mirror_idx = new_idx; | ||
| 1324 | out_eagain: | 1327 | out_eagain: |
| 1325 | rpc_restart_call_prepare(task); | 1328 | rpc_restart_call_prepare(task); |
| 1326 | return -EAGAIN; | 1329 | return -EAGAIN; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 4dbb0ee23432..741ff8c9c6ed 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -2933,7 +2933,8 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
| 2933 | } | 2933 | } |
| 2934 | 2934 | ||
| 2935 | out: | 2935 | out: |
| 2936 | nfs4_sequence_free_slot(&opendata->o_res.seq_res); | 2936 | if (!opendata->cancelled) |
| 2937 | nfs4_sequence_free_slot(&opendata->o_res.seq_res); | ||
| 2937 | return ret; | 2938 | return ret; |
| 2938 | } | 2939 | } |
| 2939 | 2940 | ||
| @@ -6301,7 +6302,6 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, | |||
| 6301 | p->arg.seqid = seqid; | 6302 | p->arg.seqid = seqid; |
| 6302 | p->res.seqid = seqid; | 6303 | p->res.seqid = seqid; |
| 6303 | p->lsp = lsp; | 6304 | p->lsp = lsp; |
| 6304 | refcount_inc(&lsp->ls_count); | ||
| 6305 | /* Ensure we don't close file until we're done freeing locks! */ | 6305 | /* Ensure we don't close file until we're done freeing locks! */ |
| 6306 | p->ctx = get_nfs_open_context(ctx); | 6306 | p->ctx = get_nfs_open_context(ctx); |
| 6307 | p->l_ctx = nfs_get_lock_context(ctx); | 6307 | p->l_ctx = nfs_get_lock_context(ctx); |
| @@ -6526,7 +6526,6 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
| 6526 | p->res.lock_seqid = p->arg.lock_seqid; | 6526 | p->res.lock_seqid = p->arg.lock_seqid; |
| 6527 | p->lsp = lsp; | 6527 | p->lsp = lsp; |
| 6528 | p->server = server; | 6528 | p->server = server; |
| 6529 | refcount_inc(&lsp->ls_count); | ||
| 6530 | p->ctx = get_nfs_open_context(ctx); | 6529 | p->ctx = get_nfs_open_context(ctx); |
| 6531 | locks_init_lock(&p->fl); | 6530 | locks_init_lock(&p->fl); |
| 6532 | locks_copy_lock(&p->fl, fl); | 6531 | locks_copy_lock(&p->fl, fl); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 228970e6e52b..187d10443a15 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -2311,6 +2311,15 @@ out_exit: | |||
| 2311 | rpc_exit(task, status); | 2311 | rpc_exit(task, status); |
| 2312 | } | 2312 | } |
| 2313 | 2313 | ||
| 2314 | static bool | ||
| 2315 | rpc_check_connected(const struct rpc_rqst *req) | ||
| 2316 | { | ||
| 2317 | /* No allocated request or transport? return true */ | ||
| 2318 | if (!req || !req->rq_xprt) | ||
| 2319 | return true; | ||
| 2320 | return xprt_connected(req->rq_xprt); | ||
| 2321 | } | ||
| 2322 | |||
| 2314 | static void | 2323 | static void |
| 2315 | rpc_check_timeout(struct rpc_task *task) | 2324 | rpc_check_timeout(struct rpc_task *task) |
| 2316 | { | 2325 | { |
| @@ -2322,10 +2331,11 @@ rpc_check_timeout(struct rpc_task *task) | |||
| 2322 | dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid); | 2331 | dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid); |
| 2323 | task->tk_timeouts++; | 2332 | task->tk_timeouts++; |
| 2324 | 2333 | ||
| 2325 | if (RPC_IS_SOFTCONN(task)) { | 2334 | if (RPC_IS_SOFTCONN(task) && !rpc_check_connected(task->tk_rqstp)) { |
| 2326 | rpc_exit(task, -ETIMEDOUT); | 2335 | rpc_exit(task, -ETIMEDOUT); |
| 2327 | return; | 2336 | return; |
| 2328 | } | 2337 | } |
| 2338 | |||
| 2329 | if (RPC_IS_SOFT(task)) { | 2339 | if (RPC_IS_SOFT(task)) { |
| 2330 | if (clnt->cl_chatty) { | 2340 | if (clnt->cl_chatty) { |
| 2331 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", | 2341 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 9359539907ba..732d4b57411a 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -495,8 +495,8 @@ xs_read_stream_request(struct sock_xprt *transport, struct msghdr *msg, | |||
| 495 | int flags, struct rpc_rqst *req) | 495 | int flags, struct rpc_rqst *req) |
| 496 | { | 496 | { |
| 497 | struct xdr_buf *buf = &req->rq_private_buf; | 497 | struct xdr_buf *buf = &req->rq_private_buf; |
| 498 | size_t want, read; | 498 | size_t want, uninitialized_var(read); |
| 499 | ssize_t ret; | 499 | ssize_t uninitialized_var(ret); |
| 500 | 500 | ||
| 501 | xs_read_header(transport, buf); | 501 | xs_read_header(transport, buf); |
| 502 | 502 | ||
