linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	kbuild@lists.01.org, Fengnan Chang <changfengnan@vivo.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Subject: Re: [kbuild] [linux-next:master 11491/13209] fs/f2fs/file.c:2057 f2fs_ioc_start_atomic_write() warn: inconsistent returns '&inode->i_rwsem'.
Date: Thu, 17 Mar 2022 17:02:48 +0800	[thread overview]
Message-ID: <002a51dc-e17f-b712-ee15-ec05b647f399@kernel.org> (raw)
In-Reply-To: <202203171137.0LDg0sYz-lkp@intel.com>

On 2022/3/17 16:44, Dan Carpenter wrote:
> [ I never understand these emails which are about patch 11491/13209...
>    - dan ]
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git  master
> head:   8a11187eb62b8b910d2c5484e1f5d160e8b11eb4
> commit: a6f748c35eca6eedf2dda8b2a30abd640f1249dc [11491/13209] f2fs: fix compressed file start atomic write may cause data corruption
> config: parisc-randconfig-m031-20220317 (https://download.01.org/0day-ci/archive/20220317/202203171137.0LDg0sYz-lkp@intel.com/config )
> compiler: hppa-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> New smatch warnings:
> fs/f2fs/file.c:2057 f2fs_ioc_start_atomic_write() warn: inconsistent returns '&inode->i_rwsem'.
> 
> vim +2057 fs/f2fs/file.c
> 
> 88b88a667971599 Jaegeuk Kim     2014-10-06  1989  static int f2fs_ioc_start_atomic_write(struct file *filp)
> 88b88a667971599 Jaegeuk Kim     2014-10-06  1990  {
> 88b88a667971599 Jaegeuk Kim     2014-10-06  1991  	struct inode *inode = file_inode(filp);
> 984fc4e76d63345 Chao Yu         2022-02-04  1992  	struct user_namespace *mnt_userns = file_mnt_user_ns(filp);
> 743b620cb0516f6 Jaegeuk Kim     2019-09-09  1993  	struct f2fs_inode_info *fi = F2FS_I(inode);
> 743b620cb0516f6 Jaegeuk Kim     2019-09-09  1994  	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> f4c9c743acedc2f Chao Yu         2015-07-17  1995  	int ret;
> 88b88a667971599 Jaegeuk Kim     2014-10-06  1996
> 984fc4e76d63345 Chao Yu         2022-02-04  1997  	if (!inode_owner_or_capable(mnt_userns, inode))
> 88b88a667971599 Jaegeuk Kim     2014-10-06  1998  		return -EACCES;
> 88b88a667971599 Jaegeuk Kim     2014-10-06  1999
> e811898c97f83ae Jaegeuk Kim     2017-03-17  2000  	if (!S_ISREG(inode->i_mode))
> e811898c97f83ae Jaegeuk Kim     2017-03-17  2001  		return -EINVAL;
> e811898c97f83ae Jaegeuk Kim     2017-03-17  2002
> 038d06984f5c50a Chao Yu         2019-07-25  2003  	if (filp->f_flags & O_DIRECT)
> 038d06984f5c50a Chao Yu         2019-07-25  2004  		return -EINVAL;
> 038d06984f5c50a Chao Yu         2019-07-25  2005
> 7fb17fe44b70c85 Chao Yu         2016-05-09  2006  	ret = mnt_want_write_file(filp);
> 7fb17fe44b70c85 Chao Yu         2016-05-09  2007  	if (ret)
> 7fb17fe44b70c85 Chao Yu         2016-05-09  2008  		return ret;
> 7fb17fe44b70c85 Chao Yu         2016-05-09  2009
> 0fac558b9658479 Chao Yu         2016-05-09  2010  	inode_lock(inode);
>                                                          ^^^^^^^^^^^^^^^^^^
> 
> 0fac558b9658479 Chao Yu         2016-05-09  2011
> a6f748c35eca6ee Fengnan Chang   2022-03-10  2012  	if (!f2fs_disable_compressed_file(inode))
> a6f748c35eca6ee Fengnan Chang   2022-03-10  2013  		return -EINVAL;
>                                                                  ^^^^^^^^^^^^^^^
> goto out?

Agreed, thanks for the report, Dan.

Thanks,


  reply	other threads:[~2022-03-17  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  8:44 Dan Carpenter
2022-03-17  9:02 ` Chao Yu [this message]
2022-03-17 16:20   ` Jaegeuk Kim
2022-03-17  9:05 ` 常凤楠

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=002a51dc-e17f-b712-ee15-ec05b647f399@kernel.org \
    --to=chao@kernel.org \
    --cc=changfengnan@vivo.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jaegeuk@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=yuchao0@huawei.com \
    /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