From: kernel test robot <lkp@intel.com>
To: Sagi Grimberg <sagi@grimberg.me>, Chuck Lever <chuck.lever@oracle.com>
Cc: oe-kbuild-all@lists.linux.dev, Dai Ngo <dai.ngo@oracle.com>,
Olga Kornievskaia <aglo@umich.edu>,
Jeff Layton <jlayton@kernel.org>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 2/3] nfsd: Offer write delegations for o_wronly opens
Date: Tue, 30 Jul 2024 06:41:10 +0800 [thread overview]
Message-ID: <202407300630.V7R20Aao-lkp@intel.com> (raw)
In-Reply-To: <20240728204104.519041-3-sagi@grimberg.me>
Hi Sagi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.11-rc1 next-20240729]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sagi-Grimberg/nfsd-don-t-assume-copy-notify-when-preprocessing-the-stateid/20240729-044834
base: linus/master
patch link: https://lore.kernel.org/r/20240728204104.519041-3-sagi%40grimberg.me
patch subject: [PATCH v2 2/3] nfsd: Offer write delegations for o_wronly opens
config: sparc64-randconfig-r121-20240729 (https://download.01.org/0day-ci/archive/20240730/202407300630.V7R20Aao-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240730/202407300630.V7R20Aao-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407300630.V7R20Aao-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> fs/nfsd/nfs4state.c:5985:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected int status @@ got restricted __be32 @@
fs/nfsd/nfs4state.c:5985:32: sparse: expected int status
fs/nfsd/nfs4state.c:5985:32: sparse: got restricted __be32
fs/nfsd/nfs4state.c: note: in included file (through include/linux/wait.h, include/linux/wait_bit.h, include/linux/fs.h):
include/linux/list.h:218:19: sparse: sparse: context imbalance in 'put_clnt_odstate' - unexpected unlock
fs/nfsd/nfs4state.c:1197:9: sparse: sparse: context imbalance in 'nfs4_put_stid' - unexpected unlock
vim +5985 fs/nfsd/nfs4state.c
5895
5896 /*
5897 * The Linux NFS server does not offer write delegations to NFSv4.0
5898 * clients in order to avoid conflicts between write delegations and
5899 * GETATTRs requesting CHANGE or SIZE attributes.
5900 *
5901 * With NFSv4.1 and later minorversions, the SEQUENCE operation that
5902 * begins each COMPOUND contains a client ID. Delegation recall can
5903 * be avoided when the server recognizes the client sending a
5904 * GETATTR also holds write delegation it conflicts with.
5905 *
5906 * However, the NFSv4.0 protocol does not enable a server to
5907 * determine that a GETATTR originated from the client holding the
5908 * conflicting delegation versus coming from some other client. Per
5909 * RFC 7530 Section 16.7.5, the server must recall or send a
5910 * CB_GETATTR even when the GETATTR originates from the client that
5911 * holds the conflicting delegation.
5912 *
5913 * An NFSv4.0 client can trigger a pathological situation if it
5914 * always sends a DELEGRETURN preceded by a conflicting GETATTR in
5915 * the same COMPOUND. COMPOUND execution will always stop at the
5916 * GETATTR and the DELEGRETURN will never get executed. The server
5917 * eventually revokes the delegation, which can result in loss of
5918 * open or lock state.
5919 */
5920 static void
5921 nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
5922 struct nfs4_ol_stateid *stp, struct svc_fh *currentfh)
5923 {
5924 struct nfs4_delegation *dp;
5925 struct nfs4_openowner *oo = openowner(stp->st_stateowner);
5926 struct nfs4_client *clp = stp->st_stid.sc_client;
5927 struct svc_fh *parent = NULL;
5928 int cb_up;
5929 int status = 0;
5930 struct kstat stat;
5931 struct path path;
5932
5933 cb_up = nfsd4_cb_channel_good(oo->oo_owner.so_client);
5934 open->op_recall = false;
5935 switch (open->op_claim_type) {
5936 case NFS4_OPEN_CLAIM_PREVIOUS:
5937 if (!cb_up)
5938 open->op_recall = true;
5939 break;
5940 case NFS4_OPEN_CLAIM_NULL:
5941 parent = currentfh;
5942 fallthrough;
5943 case NFS4_OPEN_CLAIM_FH:
5944 /*
5945 * Let's not give out any delegations till everyone's
5946 * had the chance to reclaim theirs, *and* until
5947 * NLM locks have all been reclaimed:
5948 */
5949 if (locks_in_grace(clp->net))
5950 goto out_no_deleg;
5951 if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED))
5952 goto out_no_deleg;
5953 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE &&
5954 !clp->cl_minorversion)
5955 goto out_no_deleg;
5956 break;
5957 default:
5958 goto out_no_deleg;
5959 }
5960 dp = nfs4_set_delegation(open, stp, parent);
5961 if (IS_ERR(dp))
5962 goto out_no_deleg;
5963
5964 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid));
5965
5966 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) {
5967 open->op_delegate_type = NFS4_OPEN_DELEGATE_WRITE;
5968 trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid);
5969 path.mnt = currentfh->fh_export->ex_path.mnt;
5970 path.dentry = currentfh->fh_dentry;
5971 if (vfs_getattr(&path, &stat,
5972 (STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE),
5973 AT_STATX_SYNC_AS_STAT)) {
5974 nfs4_put_stid(&dp->dl_stid);
5975 destroy_delegation(dp);
5976 goto out_no_deleg;
5977 }
5978 dp->dl_cb_fattr.ncf_cur_fsize = stat.size;
5979 dp->dl_cb_fattr.ncf_initial_cinfo =
5980 nfsd4_change_attribute(&stat, d_inode(currentfh->fh_dentry));
5981 if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) != NFS4_SHARE_ACCESS_BOTH) {
5982 struct nfsd_file *nf = NULL;
5983
5984 /* make sure the file is opened locally for O_RDWR */
> 5985 status = nfsd_file_acquire_opened(rqstp, currentfh,
5986 nfs4_access_to_access(NFS4_SHARE_ACCESS_BOTH),
5987 open->op_filp, &nf);
5988 if (status) {
5989 nfs4_put_stid(&dp->dl_stid);
5990 destroy_delegation(dp);
5991 goto out_no_deleg;
5992 }
5993 stp->st_stid.sc_file->fi_fds[O_RDWR] = nf;
5994 }
5995 } else {
5996 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ;
5997 trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid);
5998 }
5999 nfs4_put_stid(&dp->dl_stid);
6000 return;
6001 out_no_deleg:
6002 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
6003 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
6004 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {
6005 dprintk("NFSD: WARNING: refusing delegation reclaim\n");
6006 open->op_recall = true;
6007 }
6008
6009 /* 4.1 client asking for a delegation? */
6010 if (open->op_deleg_want)
6011 nfsd4_open_deleg_none_ext(open, status);
6012 return;
6013 }
6014
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2024-07-29 22:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-28 20:41 [PATCH v2 0/3] Offer write delegations for O_WRONLY opens Sagi Grimberg
2024-07-28 20:41 ` [PATCH v2 1/3] nfsd: don't assume copy notify when preprocessing the stateid Sagi Grimberg
2024-07-28 20:41 ` [PATCH v2 2/3] nfsd: Offer write delegations for o_wronly opens Sagi Grimberg
2024-07-29 12:10 ` Jeff Layton
2024-07-29 12:58 ` Sagi Grimberg
2024-07-29 13:10 ` Jeff Layton
2024-07-29 13:39 ` Sagi Grimberg
2024-07-29 13:52 ` Chuck Lever
2024-07-29 14:05 ` Sagi Grimberg
2024-07-29 14:10 ` Chuck Lever
2024-07-29 14:21 ` Jeff Layton
2024-07-29 14:12 ` Jeff Layton
2024-07-29 16:12 ` Dai Ngo
2024-07-30 18:45 ` Chuck Lever
2024-07-29 12:26 ` Jeff Layton
2024-07-29 12:59 ` Sagi Grimberg
2024-07-29 13:17 ` Jeff Layton
2024-07-29 13:37 ` Sagi Grimberg
2024-07-29 22:41 ` kernel test robot [this message]
2024-07-28 20:41 ` [PATCH v2 3/3] nfsd: resolve possible conflicts of reads using special stateids and write delegations Sagi Grimberg
2024-07-29 0:35 ` kernel test robot
2024-07-29 6:22 ` Sagi Grimberg
2024-07-29 7:55 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202407300630.V7R20Aao-lkp@intel.com \
--to=lkp@intel.com \
--cc=aglo@umich.edu \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox