Message ID | 1586981683-3077-3-git-send-email-dwysocha@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] NFS: Fix fscache super_cookie index_key from changing after umount | expand |
Hi Dave, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on nfs/linux-next] [also build test WARNING on v5.7-rc1 next-20200415] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Dave-Wysochanski/NFS-Fix-fscache-super_cookie-index_key-from-changing-after-umount/20200416-070856 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: c6x-allyesconfig (attached as .config) compiler: c6x-elf-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=c6x If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> fs/nfs/fscache.c:228:8: warning: return type defaults to 'int' [-Wreturn-type] 228 | static nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/nfs/fscache.c: In function 'nfs_fscache_update_auxdata': >> fs/nfs/fscache.c:239:1: warning: control reaches end of non-void function [-Wreturn-type] 239 | } | ^ vim +/int +228 fs/nfs/fscache.c 227 > 228 static nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, 229 struct nfs_inode *nfsi) 230 { 231 memset(auxdata, 0, sizeof(*auxdata)); 232 auxdata->mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; 233 auxdata->mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; 234 auxdata->ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; 235 auxdata->ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; 236 237 if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) 238 auxdata->change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); > 239 } 240 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Apologies for somehow missing this, resent v2 of 3/3 with 'void' added to prototype. Should be static void nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, On Wed, Apr 15, 2020 at 9:49 PM kbuild test robot <lkp@intel.com> wrote: > > Hi Dave, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on nfs/linux-next] > [also build test WARNING on v5.7-rc1 next-20200415] > [if your patch is applied to the wrong git tree, please drop us a note to help > improve the system. BTW, we also suggest to use '--base' option to specify the > base tree in git format-patch, please see https://stackoverflow.com/a/37406982] > > url: https://github.com/0day-ci/linux/commits/Dave-Wysochanski/NFS-Fix-fscache-super_cookie-index_key-from-changing-after-umount/20200416-070856 > base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next > config: c6x-allyesconfig (attached as .config) > compiler: c6x-elf-gcc (GCC) 9.3.0 > reproduce: > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=c6x > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kbuild test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> fs/nfs/fscache.c:228:8: warning: return type defaults to 'int' [-Wreturn-type] > 228 | static nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > fs/nfs/fscache.c: In function 'nfs_fscache_update_auxdata': > >> fs/nfs/fscache.c:239:1: warning: control reaches end of non-void function [-Wreturn-type] > 239 | } > | ^ > > vim +/int +228 fs/nfs/fscache.c > > 227 > > 228 static nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, > 229 struct nfs_inode *nfsi) > 230 { > 231 memset(auxdata, 0, sizeof(*auxdata)); > 232 auxdata->mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; > 233 auxdata->mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; > 234 auxdata->ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; > 235 auxdata->ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; > 236 > 237 if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) > 238 auxdata->change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); > > 239 } > 240 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index f51718415606..e3240f9f9570 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c @@ -225,6 +225,19 @@ void nfs_fscache_release_super_cookie(struct super_block *sb) } } +static nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, + struct nfs_inode *nfsi) +{ + memset(auxdata, 0, sizeof(*auxdata)); + auxdata->mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; + auxdata->mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; + auxdata->ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; + auxdata->ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; + + if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) + auxdata->change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); +} + /* * Initialise the per-inode cache cookie pointer for an NFS inode. */ @@ -238,14 +251,7 @@ void nfs_fscache_init_inode(struct inode *inode) if (!(nfss->fscache && S_ISREG(inode->i_mode))) return; - memset(&auxdata, 0, sizeof(auxdata)); - auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; - auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; - auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; - auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; - - if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) - auxdata.change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); + nfs_fscache_update_auxdata(&auxdata, nfsi); nfsi->fscache = fscache_acquire_cookie(NFS_SB(inode->i_sb)->fscache, &nfs_fscache_inode_object_def, @@ -265,11 +271,7 @@ void nfs_fscache_clear_inode(struct inode *inode) dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie); - memset(&auxdata, 0, sizeof(auxdata)); - auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; - auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; - auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; - auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; + nfs_fscache_update_auxdata(&auxdata, nfsi); fscache_relinquish_cookie(cookie, &auxdata, false); nfsi->fscache = NULL; } @@ -309,11 +311,7 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp) if (!fscache_cookie_valid(cookie)) return; - memset(&auxdata, 0, sizeof(auxdata)); - auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; - auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; - auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; - auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; + nfs_fscache_update_auxdata(&auxdata, nfsi); if (inode_is_open_for_write(inode)) { dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi);
Commit 402cb8dda949 ("fscache: Attach the index key and aux data to the cookie") added the aux_data and aux_data_len to parameters to fscache_acquire_cookie(), and updated the callers in the NFS client. In the process it modified the aux_data to include the change_attr, but missed adding change_attr to a couple places where aux_data was used. Specifically, when opening a file and the change_attr is not added, the following attempt to lookup an object will fail inside cachefiles_check_object_xattr() = -116 due to nfs_fscache_inode_check_aux() failing memcmp on auxdata and returning FSCACHE_CHECKAUX_OBSOLETE. Fix this by adding nfs_fscache_update_auxdata() to set the auxdata from all relevant fields in the inode, including the change_attr. Fixes: 402cb8dda949 ("fscache: Attach the index key and aux data to the cookie") Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> --- fs/nfs/fscache.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)