From: Greg Kroah-Hartman Date: Sat, 8 Feb 2014 23:59:05 +0000 (-0800) Subject: 3.4-stable patches X-Git-Tag: v3.4.80~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3cbe1e28f05622a181d0f159d3a4ca218bef8498;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: nfs4.1-properly-handle-enotsup-in-secinfo_no_name.patch nfsv4-open-must-handle-the-nfs4err_io-return-code-correctly.patch sunrpc-fix-infinite-loop-in-rpc-state-machine.patch --- diff --git a/queue-3.4/nfs4.1-properly-handle-enotsup-in-secinfo_no_name.patch b/queue-3.4/nfs4.1-properly-handle-enotsup-in-secinfo_no_name.patch new file mode 100644 index 00000000000..e925fdb1c3d --- /dev/null +++ b/queue-3.4/nfs4.1-properly-handle-enotsup-in-secinfo_no_name.patch @@ -0,0 +1,44 @@ +From 78b19bae0813bd6f921ca58490196abd101297bd Mon Sep 17 00:00:00 2001 +From: Weston Andros Adamson +Date: Mon, 13 Jan 2014 16:54:45 -0500 +Subject: nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME + +From: Weston Andros Adamson + +commit 78b19bae0813bd6f921ca58490196abd101297bd upstream. + +Don't check for -NFS4ERR_NOTSUPP, it's already been mapped to -ENOTSUPP +by nfs4_stat_to_errno. + +This allows the client to mount v4.1 servers that don't support +SECINFO_NO_NAME by falling back to the "guess and check" method of +nfs4_find_root_sec. + +Signed-off-by: Weston Andros Adamson +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs4proc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -6394,7 +6394,7 @@ nfs41_proc_secinfo_no_name(struct nfs_se + switch (err) { + case 0: + case -NFS4ERR_WRONGSEC: +- case -NFS4ERR_NOTSUPP: ++ case -ENOTSUPP: + goto out; + default: + err = nfs4_handle_exception(server, err, &exception); +@@ -6426,7 +6426,7 @@ nfs41_find_root_sec(struct nfs_server *s + * Fall back on "guess and check" method if + * the server doesn't support SECINFO_NO_NAME + */ +- if (err == -NFS4ERR_WRONGSEC || err == -NFS4ERR_NOTSUPP) { ++ if (err == -NFS4ERR_WRONGSEC || err == -ENOTSUPP) { + err = nfs4_find_root_sec(server, fhandle, info); + goto out_freepage; + } diff --git a/queue-3.4/nfsv4-open-must-handle-the-nfs4err_io-return-code-correctly.patch b/queue-3.4/nfsv4-open-must-handle-the-nfs4err_io-return-code-correctly.patch new file mode 100644 index 00000000000..b541fe1b5e7 --- /dev/null +++ b/queue-3.4/nfsv4-open-must-handle-the-nfs4err_io-return-code-correctly.patch @@ -0,0 +1,97 @@ +From c7848f69ec4a8c03732cde5c949bd2aa711a9f4b Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Wed, 4 Dec 2013 17:39:23 -0500 +Subject: NFSv4: OPEN must handle the NFS4ERR_IO return code correctly + +From: Trond Myklebust + +commit c7848f69ec4a8c03732cde5c949bd2aa711a9f4b upstream. + +decode_op_hdr() cannot distinguish between an XDR decoding error and +the perfectly valid errorcode NFS4ERR_IO. This is normally not a +problem, but for the particular case of OPEN, we need to be able +to increment the NFSv4 open sequence id when the server returns +a valid response. + +Reported-by: J Bruce Fields +Link: http://lkml.kernel.org/r/20131204210356.GA19452@fieldses.org +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs4xdr.c | 47 +++++++++++++++++++++++++++++++---------------- + 1 file changed, 31 insertions(+), 16 deletions(-) + +--- a/fs/nfs/nfs4xdr.c ++++ b/fs/nfs/nfs4xdr.c +@@ -2955,7 +2955,8 @@ out_overflow: + return -EIO; + } + +-static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) ++static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected, ++ int *nfs_retval) + { + __be32 *p; + uint32_t opnum; +@@ -2965,19 +2966,32 @@ static int decode_op_hdr(struct xdr_stre + if (unlikely(!p)) + goto out_overflow; + opnum = be32_to_cpup(p++); +- if (opnum != expected) { +- dprintk("nfs: Server returned operation" +- " %d but we issued a request for %d\n", +- opnum, expected); +- return -EIO; +- } ++ if (unlikely(opnum != expected)) ++ goto out_bad_operation; + nfserr = be32_to_cpup(p); +- if (nfserr != NFS_OK) +- return nfs4_stat_to_errno(nfserr); +- return 0; ++ if (nfserr == NFS_OK) ++ *nfs_retval = 0; ++ else ++ *nfs_retval = nfs4_stat_to_errno(nfserr); ++ return true; ++out_bad_operation: ++ dprintk("nfs: Server returned operation" ++ " %d but we issued a request for %d\n", ++ opnum, expected); ++ *nfs_retval = -EREMOTEIO; ++ return false; + out_overflow: + print_overflow_msg(__func__, xdr); +- return -EIO; ++ *nfs_retval = -EIO; ++ return false; ++} ++ ++static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) ++{ ++ int retval; ++ ++ __decode_op_hdr(xdr, expected, &retval); ++ return retval; + } + + /* Dummy routine */ +@@ -4680,11 +4694,12 @@ static int decode_open(struct xdr_stream + uint32_t savewords, bmlen, i; + int status; + +- status = decode_op_hdr(xdr, OP_OPEN); +- if (status != -EIO) +- nfs_increment_open_seqid(status, res->seqid); +- if (!status) +- status = decode_stateid(xdr, &res->stateid); ++ if (!__decode_op_hdr(xdr, OP_OPEN, &status)) ++ return status; ++ nfs_increment_open_seqid(status, res->seqid); ++ if (status) ++ return status; ++ status = decode_stateid(xdr, &res->stateid); + if (unlikely(status)) + return status; + diff --git a/queue-3.4/series b/queue-3.4/series index 5cfae288efa..5e70e849904 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -9,3 +9,6 @@ mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch ore-fix-wrong-math-in-allocation-of-per-device-bio.patch ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch spidev-fix-hang-when-transfer_one_message-fails.patch +nfsv4-open-must-handle-the-nfs4err_io-return-code-correctly.patch +nfs4.1-properly-handle-enotsup-in-secinfo_no_name.patch +sunrpc-fix-infinite-loop-in-rpc-state-machine.patch diff --git a/queue-3.4/sunrpc-fix-infinite-loop-in-rpc-state-machine.patch b/queue-3.4/sunrpc-fix-infinite-loop-in-rpc-state-machine.patch new file mode 100644 index 00000000000..ec0603e1710 --- /dev/null +++ b/queue-3.4/sunrpc-fix-infinite-loop-in-rpc-state-machine.patch @@ -0,0 +1,119 @@ +From 6ff33b7dd0228b7d7ed44791bbbc98b03fd15d9d Mon Sep 17 00:00:00 2001 +From: Weston Andros Adamson +Date: Tue, 17 Dec 2013 12:16:11 -0500 +Subject: sunrpc: Fix infinite loop in RPC state machine + +From: Weston Andros Adamson + +commit 6ff33b7dd0228b7d7ed44791bbbc98b03fd15d9d upstream. + +When a task enters call_refreshresult with status 0 from call_refresh and +!rpcauth_uptodatecred(task) it enters call_refresh again with no rate-limiting +or max number of retries. + +Instead of trying forever, make use of the retry path that other errors use. + +This only seems to be possible when the crrefresh callback is gss_refresh_null, +which only happens when destroying the context. + +To reproduce: + +1) mount with sec=krb5 (or sec=sys with krb5 negotiated for non FSID specific + operations). + +2) reboot - the client will be stuck and will need to be hard rebooted + +BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:2:46] +Modules linked in: rpcsec_gss_krb5 nfsv4 nfs fscache ppdev crc32c_intel aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd serio_raw i2c_piix4 i2c_core e1000 parport_pc parport shpchp nfsd auth_rpcgss oid_registry exportfs nfs_acl lockd sunrpc autofs4 mptspi scsi_transport_spi mptscsih mptbase ata_generic floppy +irq event stamp: 195724 +hardirqs last enabled at (195723): [] restore_args+0x0/0x30 +hardirqs last disabled at (195724): [] apic_timer_interrupt+0x6a/0x80 +softirqs last enabled at (195722): [] __do_softirq+0x1df/0x276 +softirqs last disabled at (195717): [] irq_exit+0x53/0x9a +CPU: 0 PID: 46 Comm: kworker/0:2 Not tainted 3.13.0-rc3-branch-dros_testing+ #4 +Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013 +Workqueue: rpciod rpc_async_schedule [sunrpc] +task: ffff8800799c4260 ti: ffff880079002000 task.ti: ffff880079002000 +RIP: 0010:[] [] __rpc_execute+0x8a/0x362 [sunrpc] +RSP: 0018:ffff880079003d18 EFLAGS: 00000246 +RAX: 0000000000000005 RBX: 0000000000000007 RCX: 0000000000000007 +RDX: 0000000000000007 RSI: ffff88007aecbae8 RDI: ffff8800783d8900 +RBP: ffff880079003d78 R08: ffff88006e30e9f8 R09: ffffffffa005a3d7 +R10: ffff88006e30e7b0 R11: ffff8800783d8900 R12: ffffffffa006675e +R13: ffff880079003ce8 R14: ffff88006e30e7b0 R15: ffff8800783d8900 +FS: 0000000000000000(0000) GS:ffff88007f200000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 00007f3072333000 CR3: 0000000001a0b000 CR4: 00000000001407f0 +Stack: + ffff880079003d98 0000000000000246 0000000000000000 ffff88007a9a4830 + ffff880000000000 ffffffff81073f47 ffff88007f212b00 ffff8800799c4260 + ffff8800783d8988 ffff88007f212b00 ffffe8ffff604800 0000000000000000 +Call Trace: + [] ? trace_hardirqs_on_caller+0x145/0x1a1 + [] rpc_async_schedule+0x27/0x32 [sunrpc] + [] process_one_work+0x211/0x3a5 + [] ? process_one_work+0x172/0x3a5 + [] worker_thread+0x134/0x202 + [] ? rescuer_thread+0x280/0x280 + [] ? rescuer_thread+0x280/0x280 + [] kthread+0xc9/0xd1 + [] ? __kthread_parkme+0x61/0x61 + [] ret_from_fork+0x7c/0xb0 + [] ? __kthread_parkme+0x61/0x61 +Code: e8 87 63 fd e0 c6 05 10 dd 01 00 01 48 8b 43 70 4c 8d 6b 70 45 31 e4 a8 02 0f 85 d5 02 00 00 4c 8b 7b 48 48 c7 43 48 00 00 00 00 <4c> 8b 4b 50 4d 85 ff 75 0c 4d 85 c9 4d 89 cf 0f 84 32 01 00 00 + +And the output of "rpcdebug -m rpc -s all": + +RPC: 61 call_refresh (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 call_refreshresult (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 call_refreshresult (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 call_refresh (status 0) +RPC: 61 call_refreshresult (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 call_refreshresult (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 call_refresh (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 +RPC: 61 call_refreshresult (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 call_refresh (status 0) +RPC: 61 call_refreshresult (status 0) +RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 + +Signed-off-by: Weston Andros Adamson +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + net/sunrpc/clnt.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/net/sunrpc/clnt.c ++++ b/net/sunrpc/clnt.c +@@ -1331,9 +1331,13 @@ call_refreshresult(struct rpc_task *task + task->tk_action = call_refresh; + switch (status) { + case 0: +- if (rpcauth_uptodatecred(task)) ++ if (rpcauth_uptodatecred(task)) { + task->tk_action = call_allocate; +- return; ++ return; ++ } ++ /* Use rate-limiting and a max number of retries if refresh ++ * had status 0 but failed to update the cred. ++ */ + case -ETIMEDOUT: + rpc_delay(task, 3*HZ); + case -EAGAIN: