Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1222586ybl; Wed, 18 Dec 2019 14:47:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwZpVlPaPOpwsThpDh3VaIpCxx1poMXwqUMpGjP+IkVN46ICUYEqtlahEd4+4jS0Clt0h83 X-Received: by 2002:a9d:68cb:: with SMTP id i11mr2273535oto.210.1576709274546; Wed, 18 Dec 2019 14:47:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576709274; cv=none; d=google.com; s=arc-20160816; b=bfcmY14WGn38hqJpKE2DUvwcOJs3XTe6vtSHb7RsC5M3IIU8521IF8xKVPSPt3b9AG R7+oTd6jyUY0nN4CnO0qdQ8UU4F1wB0+3Y7ak9lIiKoOJoSHwV6eVMpso0BUvdRCdXDf z4R1NN7TsWHaH87gk327bIAF6u5mU/nbKkY94Qzk3uuHvF16nftkbLeRv5NlDfOZ+zys VxqNdMWcv8iynYcpJSLYTtaXxfL5DphmTpM+waEjKEL9CEgo3r2qUl3x8keDhDH64Ozf tbGa/UNaTMY6Jh/qDmGzJJRSsJpdbpneZ0iiOttkeLIdOcp4stKTDj/e/ZFT34fqJ0Hs 97/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:cc:subject:date :to:from; bh=C3RMe/ZnhSv9E03BKjWh8rctoUnGetm7HKnlPDmJ0tA=; b=X02+eXePlS09n8zXTxMBOXGWOF0lwIe9HBsxl/HCDIOfOGKvHB2SIFI5fU9ROveAC9 N7H30USqM4djOph+SK0A1C2Gni54tWERxFWnZAvRyj02dZ+N8zJhnOTrcJo03yUO/Cr8 +/gemp1C793t1eA//We4VvRlZnyWrV71tJrfaRu3rE8Olp9h0tbyiumwI9Ogk/YmZuNq rdMIjepn+2VVkOy1lCkc7nDijAfXGaLPYH8iVgRL+a3Eaoy909b5869y13gdoje9WtGr o0TBj4SCQwWUM749/ezO15+vPQBCmHg4xVto/3peFlN+7bc5m+9QUttlmkPgte0N4vIi W2Ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si2281454oiy.116.2019.12.18.14.47.34; Wed, 18 Dec 2019 14:47:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbfLRWrd (ORCPT + 99 others); Wed, 18 Dec 2019 17:47:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:53908 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbfLRWrd (ORCPT ); Wed, 18 Dec 2019 17:47:33 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2041CAC45; Wed, 18 Dec 2019 22:47:30 +0000 (UTC) From: NeilBrown To: Trond Myklebust , Anna Schumaker Date: Thu, 19 Dec 2019 09:47:23 +1100 Subject: [PATCH/RFC] NFS: handle NFSv4.1 server that doesn't support NFS4_OPEN_CLAIM_DELEG_CUR_FH cc: linux-nfs@vger.kernel.org Message-ID: <87y2v9fdz8.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org --=-=-= Content-Type: text/plain If an NFSv4.1 server doesn't support NFS4_OPEN_CLAIM_DELEG_CUR_FH (e.g. Linux 3.0), and a newer NFS client tries to use it to claim an open before returning a delegation, the server might return NFS4ERR_BADXDR. That is what Linux 3.0 does, though the RFC doesn't seem to be explicit on which flags must be supported, and what error can be returned for unsupported flags. When NFS_CAP_ATOMIC_OPEN_V1 support was added in Commit 49f9a0fafd84 ("NFSv4.1: Enable open-by-filehandle"), fall-back for non-supporting servers was added for various open types, but not for delegation recall. The code pattern for delegation recall is a little different to the other open types, so I cannot simply copy the same approach. I think the below patch should do the right thing, but I haven't tested yet. Does this look reasonable? Is there a cleaner way to do it? Should we check other errors? Thanks, NeilBrown diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index caacf5e7f5e1..14f958d16648 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2174,6 +2174,13 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs4_state *state, const nfs4_stateid *stateid, struct file_lock *fl, int err) { switch (err) { + case -NFS4ERR_BADXDR: { + struct nfs4_exception exception; + if (nfs4_clear_cap_atomic_open_v1(server, -EINVAL, + &exception)) + return -EAGAIN; + } + /* fallthrough */ default: printk(KERN_ERR "NFS: %s: unhandled error " "%d.\n", __func__, err); --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAl36rHsACgkQOeye3VZi gblFgxAAhZuE6cimSKhoB2nrCMUjdAKa8E//LcZI8pWh5rzw1M4CNhwxPIlRz3P5 9kS7DcHWck3puQQwSr4C0kIXQ3rGLHQvCBPfMLAm1h1LYsi5bmegD2xViE6KNG8/ fBazsE9+R+F9UP7SSPSyA+Rl8vnJmzW0ibFUMqVsaxqKJ0RI5N76/EIWB4HV45lr Y+e0VSFncC/h45Uxr4cuVyaQgv9SoepmfC4sbwOCycAnNCVdhqKrJc95C9Gci6An BnCe/NQOIbNnhflOSodDKGU5SXp7PMY4t0ZFSLh8QXg58VOpreMwePCJiLIdD47z fG7g/LNoNTtjHBdL1mefD8znuzXeOO2osG1C1PyYoPPtDp8Bpy/BS8VrSQGHpzXV 9yW4DWpqeoAsx/nDrGTHiIeH293L293/zvhlNiKes5Vv0PYfj+CFG3JXe8B81Nr9 SKd/IOgzYf0V50Gv9+YGXMSjTAuDsgwq2yeMWlWOMprYmsawZriQpOK7MjQZ/ZHi siFPWWe+InhH47VfXGS7aqVX+dfEgCWVoD7pB8spp7800+iuWJpVY/Uqf877FQUp OspBRNbIKf/4iVj+o/Z9C4QtD73q71DnVgwunkJ9e3u1GM3p+kTslqCxWz7xPzEV jDZOQql/JUmfwgx/pmFkYvRbZ1wyAg9oXJTHJCDzY1KtAGS4+fA= =aFhz -----END PGP SIGNATURE----- --=-=-=--