Re: [PATCH v4 2/5] fuse: Call vfs_get_tree() for submounts

From: kernel test robot
Date: Sat May 22 2021 - 13:52:10 EST


Hi Greg,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fuse/for-next]
[also build test WARNING on linux/master linus/master v5.13-rc2 next-20210521]
[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]

url: https://github.com/0day-ci/linux/commits/Greg-Kurz/virtiofs-propagate-sync-to-file-server/20210522-210652
base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
config: nds32-randconfig-r011-20210522 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/ee3cc45c5a2311efc82021bd5463271507bef828
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Greg-Kurz/virtiofs-propagate-sync-to-file-server/20210522-210652
git checkout ee3cc45c5a2311efc82021bd5463271507bef828
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/fuse/dir.c: In function 'fuse_dentry_automount':
>> fs/fuse/dir.c:312:21: warning: variable 'fm' set but not used [-Wunused-but-set-variable]
312 | struct fuse_mount *fm;
| ^~


vim +/fm +312 fs/fuse/dir.c

8fab010644363f Miklos Szeredi 2018-08-15 303
bf109c64040f5b Max Reitz 2020-04-21 304 /*
bf109c64040f5b Max Reitz 2020-04-21 305 * Create a fuse_mount object with a new superblock (with path->dentry
bf109c64040f5b Max Reitz 2020-04-21 306 * as the root), and return that mount so it can be auto-mounted on
bf109c64040f5b Max Reitz 2020-04-21 307 * @path.
bf109c64040f5b Max Reitz 2020-04-21 308 */
bf109c64040f5b Max Reitz 2020-04-21 309 static struct vfsmount *fuse_dentry_automount(struct path *path)
bf109c64040f5b Max Reitz 2020-04-21 310 {
bf109c64040f5b Max Reitz 2020-04-21 311 struct fs_context *fsc;
bf109c64040f5b Max Reitz 2020-04-21 @312 struct fuse_mount *fm;
bf109c64040f5b Max Reitz 2020-04-21 313 struct vfsmount *mnt;
bf109c64040f5b Max Reitz 2020-04-21 314 struct fuse_inode *mp_fi = get_fuse_inode(d_inode(path->dentry));
bf109c64040f5b Max Reitz 2020-04-21 315 int err;
bf109c64040f5b Max Reitz 2020-04-21 316
bf109c64040f5b Max Reitz 2020-04-21 317 fsc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
bf109c64040f5b Max Reitz 2020-04-21 318 if (IS_ERR(fsc)) {
bf109c64040f5b Max Reitz 2020-04-21 319 err = PTR_ERR(fsc);
bf109c64040f5b Max Reitz 2020-04-21 320 goto out;
bf109c64040f5b Max Reitz 2020-04-21 321 }
bf109c64040f5b Max Reitz 2020-04-21 322
ee3cc45c5a2311 Greg Kurz 2021-05-20 323 /*
ee3cc45c5a2311 Greg Kurz 2021-05-20 324 * Hijack fsc->fs_private to pass the mount point inode to
ee3cc45c5a2311 Greg Kurz 2021-05-20 325 * fuse_get_tree_submount(). It *must* be NULLified afterwards
ee3cc45c5a2311 Greg Kurz 2021-05-20 326 * to avoid the inode pointer to be passed to kfree() when
ee3cc45c5a2311 Greg Kurz 2021-05-20 327 * the context gets freed.
ee3cc45c5a2311 Greg Kurz 2021-05-20 328 */
ee3cc45c5a2311 Greg Kurz 2021-05-20 329 fsc->fs_private = mp_fi;
ee3cc45c5a2311 Greg Kurz 2021-05-20 330 err = vfs_get_tree(fsc);
ee3cc45c5a2311 Greg Kurz 2021-05-20 331 fsc->fs_private = NULL;
ee3cc45c5a2311 Greg Kurz 2021-05-20 332 if (err)
bf109c64040f5b Max Reitz 2020-04-21 333 goto out_put_fsc;
bf109c64040f5b Max Reitz 2020-04-21 334
ee3cc45c5a2311 Greg Kurz 2021-05-20 335 fm = get_fuse_mount_super(fsc->root->d_sb);
bf109c64040f5b Max Reitz 2020-04-21 336
bf109c64040f5b Max Reitz 2020-04-21 337 /* Create the submount */
bf109c64040f5b Max Reitz 2020-04-21 338 mnt = vfs_create_mount(fsc);
bf109c64040f5b Max Reitz 2020-04-21 339 if (IS_ERR(mnt)) {
bf109c64040f5b Max Reitz 2020-04-21 340 err = PTR_ERR(mnt);
bf109c64040f5b Max Reitz 2020-04-21 341 goto out_put_fsc;
bf109c64040f5b Max Reitz 2020-04-21 342 }
bf109c64040f5b Max Reitz 2020-04-21 343 mntget(mnt);
bf109c64040f5b Max Reitz 2020-04-21 344 put_fs_context(fsc);
bf109c64040f5b Max Reitz 2020-04-21 345 return mnt;
bf109c64040f5b Max Reitz 2020-04-21 346
bf109c64040f5b Max Reitz 2020-04-21 347 out_put_fsc:
bf109c64040f5b Max Reitz 2020-04-21 348 put_fs_context(fsc);
bf109c64040f5b Max Reitz 2020-04-21 349 out:
bf109c64040f5b Max Reitz 2020-04-21 350 return ERR_PTR(err);
bf109c64040f5b Max Reitz 2020-04-21 351 }
bf109c64040f5b Max Reitz 2020-04-21 352

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip