CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Mel Gorman <[email protected]>

Hi Mel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on ext3/fsnotify]
[also build test WARNING on v5.7 next-20200608]
[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/Mel-Gorman/fsnotify-Rearrange-fast-path-to-minimise-overhead-when-there-is-no-watcher/20200608-220745
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git 
fsnotify
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-m021-20200607 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
fs/notify/fsnotify.c:341 fsnotify() error: we previously assumed 'mnt' could be 
null (see line 333)

Old smatch warnings:
fs/notify/fsnotify.c:140 __fsnotify_update_child_dentry_flags() error: double 
unlocked 'alias->d_lockref.lock' (orig line 138)

# 
https://github.com/0day-ci/linux/commit/3c0b72381918767551923e484bc915c26a258e2a
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 3c0b72381918767551923e484bc915c26a258e2a
vim +/mnt +341 fs/notify/fsnotify.c

d9a6f30bb89309 Amir Goldstein         2018-04-20  304  
90586523eb4b34 Eric Paris             2009-05-21  305  /*
90586523eb4b34 Eric Paris             2009-05-21  306   * This is the main call 
to fsnotify.  The VFS calls into hook specific functions
90586523eb4b34 Eric Paris             2009-05-21  307   * in linux/fsnotify.h.  
Those functions then in turn call here.  Here will call
90586523eb4b34 Eric Paris             2009-05-21  308   * out to all of the 
registered fsnotify_group.  Those groups can then use the
90586523eb4b34 Eric Paris             2009-05-21  309   * notification event in 
whatever means they feel necessary.
90586523eb4b34 Eric Paris             2009-05-21  310   */
e637835eccc8b9 Al Viro                2016-11-20  311  int fsnotify(struct 
inode *to_tell, __u32 mask, const void *data, int data_is,
25b229dff4ffff Al Viro                2019-04-26  312        const struct qstr 
*file_name, u32 cookie)
90586523eb4b34 Eric Paris             2009-05-21  313  {
aa93bdc5500cc9 Amir Goldstein         2020-03-19  314   const struct path *path 
= fsnotify_data_path(data, data_is);
3427ce71554123 Miklos Szeredi         2017-10-30  315   struct 
fsnotify_iter_info iter_info = {};
45a9fb3725d886 Amir Goldstein         2019-01-10  316   struct super_block *sb 
= to_tell->i_sb;
60f7ed8c7c4d06 Amir Goldstein         2018-09-01  317   struct mount *mnt = 
NULL;
3c0b7238191876 Mel Gorman             2020-06-08  318   __u32 mnt_or_sb_mask;
9385a84d7e1f65 Jan Kara               2016-11-10  319   int ret = 0;
3c0b7238191876 Mel Gorman             2020-06-08  320   __u32 test_mask;
90586523eb4b34 Eric Paris             2009-05-21  321  
3c0b7238191876 Mel Gorman             2020-06-08  322   if (path)
aa93bdc5500cc9 Amir Goldstein         2020-03-19  323           mnt = 
real_mount(path->mnt);
3a9fb89f4cd04c Eric Paris             2009-12-17  324  
7c49b8616460eb Dave Hansen            2015-09-04  325   /*
7c49b8616460eb Dave Hansen            2015-09-04  326    * Optimization: 
srcu_read_lock() has a memory barrier which can
7c49b8616460eb Dave Hansen            2015-09-04  327    * be expensive.  It 
protects walking the *_fsnotify_marks lists.
7c49b8616460eb Dave Hansen            2015-09-04  328    * However, if we do 
not walk the lists, we do not have to do
7c49b8616460eb Dave Hansen            2015-09-04  329    * SRCU because we have 
no references to any objects and do not
7c49b8616460eb Dave Hansen            2015-09-04  330    * need SRCU to keep 
them "alive".
7c49b8616460eb Dave Hansen            2015-09-04  331    */
45a9fb3725d886 Amir Goldstein         2019-01-10  332   if 
(!to_tell->i_fsnotify_marks && !sb->s_fsnotify_marks &&
45a9fb3725d886 Amir Goldstein         2019-01-10 @333       (!mnt || 
!mnt->mnt_fsnotify_marks))
7c49b8616460eb Dave Hansen            2015-09-04  334           return 0;
3c0b7238191876 Mel Gorman             2020-06-08  335  
3c0b7238191876 Mel Gorman             2020-06-08  336   /* An event "on child" 
is not intended for a mount/sb mark */
3c0b7238191876 Mel Gorman             2020-06-08  337   mnt_or_sb_mask = 0;
3c0b7238191876 Mel Gorman             2020-06-08  338   if (!(mask & 
FS_EVENT_ON_CHILD)) {
3c0b7238191876 Mel Gorman             2020-06-08  339           mnt_or_sb_mask 
= sb->s_fsnotify_mask;
3c0b7238191876 Mel Gorman             2020-06-08  340           if (path)
3c0b7238191876 Mel Gorman             2020-06-08 @341                   
mnt_or_sb_mask |= mnt->mnt_fsnotify_mask;
3c0b7238191876 Mel Gorman             2020-06-08  342   }
3c0b7238191876 Mel Gorman             2020-06-08  343  
613a807fe7c793 Eric Paris             2010-07-28  344   /*
613a807fe7c793 Eric Paris             2010-07-28  345    * if this is a modify 
event we may need to clear the ignored masks
60f7ed8c7c4d06 Amir Goldstein         2018-09-01  346    * otherwise return if 
neither the inode nor the vfsmount/sb care about
613a807fe7c793 Eric Paris             2010-07-28  347    * this type of event.
613a807fe7c793 Eric Paris             2010-07-28  348    */
3c0b7238191876 Mel Gorman             2020-06-08  349   test_mask = (mask & 
ALL_FSNOTIFY_EVENTS);
613a807fe7c793 Eric Paris             2010-07-28  350   if (!(mask & FS_MODIFY) 
&&
60f7ed8c7c4d06 Amir Goldstein         2018-09-01  351       !(test_mask & 
(to_tell->i_fsnotify_mask | mnt_or_sb_mask)))
613a807fe7c793 Eric Paris             2010-07-28  352           return 0;
75c1be487a690d Eric Paris             2010-07-28  353  
9385a84d7e1f65 Jan Kara               2016-11-10  354   iter_info.srcu_idx = 
srcu_read_lock(&fsnotify_mark_srcu);
75c1be487a690d Eric Paris             2010-07-28  355  
47d9c7cc457adc Amir Goldstein         2018-04-20  356   
iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
3427ce71554123 Miklos Szeredi         2017-10-30  357           
fsnotify_first_mark(&to_tell->i_fsnotify_marks);
45a9fb3725d886 Amir Goldstein         2019-01-10  358   
iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
45a9fb3725d886 Amir Goldstein         2019-01-10  359           
fsnotify_first_mark(&sb->s_fsnotify_marks);
9bdda4e9cf2dce Amir Goldstein         2018-09-01  360   if (mnt) {
47d9c7cc457adc Amir Goldstein         2018-04-20  361           
iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] =
3427ce71554123 Miklos Szeredi         2017-10-30  362                   
fsnotify_first_mark(&mnt->mnt_fsnotify_marks);
7131485a93679f Eric Paris             2009-12-17  363   }
75c1be487a690d Eric Paris             2010-07-28  364  
8edc6e1688fc8f Jan Kara               2014-11-13  365   /*
60f7ed8c7c4d06 Amir Goldstein         2018-09-01  366    * We need to merge 
inode/vfsmount/sb mark lists so that e.g. inode mark
60f7ed8c7c4d06 Amir Goldstein         2018-09-01  367    * ignore masks are 
properly reflected for mount/sb mark notifications.
8edc6e1688fc8f Jan Kara               2014-11-13  368    * That's why this 
traversal is so complicated...
8edc6e1688fc8f Jan Kara               2014-11-13  369    */
d9a6f30bb89309 Amir Goldstein         2018-04-20  370   while 
(fsnotify_iter_select_report_types(&iter_info)) {
5b0457ad021f3f Amir Goldstein         2018-04-20  371           ret = 
send_to_group(to_tell, mask, data, data_is, cookie,
e43e9c339a78a0 Al Viro                2019-04-26  372                           
    file_name, &iter_info);
613a807fe7c793 Eric Paris             2010-07-28  373  
ff8bcbd03da881 Eric Paris             2010-10-28  374           if (ret && 
(mask & ALL_FSNOTIFY_PERM_EVENTS))
ff8bcbd03da881 Eric Paris             2010-10-28  375                   goto 
out;
ff8bcbd03da881 Eric Paris             2010-10-28  376  
d9a6f30bb89309 Amir Goldstein         2018-04-20  377           
fsnotify_iter_next(&iter_info);
90586523eb4b34 Eric Paris             2009-05-21  378   }
ff8bcbd03da881 Eric Paris             2010-10-28  379   ret = 0;
ff8bcbd03da881 Eric Paris             2010-10-28  380  out:
9385a84d7e1f65 Jan Kara               2016-11-10  381   
srcu_read_unlock(&fsnotify_mark_srcu, iter_info.srcu_idx);
c4ec54b40d33f8 Eric Paris             2009-12-17  382  
98b5c10d320adf Jean-Christophe Dubois 2010-03-23  383   return ret;
90586523eb4b34 Eric Paris             2009-05-21  384  }
90586523eb4b34 Eric Paris             2009-05-21  385  
EXPORT_SYMBOL_GPL(fsnotify);
90586523eb4b34 Eric Paris             2009-05-21  386  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to