public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, David Timber <dxdt@dev.snart.me>,
	linkinjeon@kernel.org, sj1557.seo@samsung.com
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	yuezhang.mo@sony.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, David Timber <dxdt@dev.snart.me>
Subject: Re: [PATCH v0 1/1] exfat: add limited FALLOC_FL_ZERO_RANGE support
Date: Mon, 23 Mar 2026 10:59:34 +0300	[thread overview]
Message-ID: <202603221252.dVVrrOrL-lkp@intel.com> (raw)
In-Reply-To: <20260319043553.301185-2-dxdt@dev.snart.me>

Hi David,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Timber/exfat-add-limited-FALLOC_FL_ZERO_RANGE-support/20260319-185700
base:   next-20260318
patch link:    https://lore.kernel.org/r/20260319043553.301185-2-dxdt%40dev.snart.me
patch subject: [PATCH v0 1/1] exfat: add limited FALLOC_FL_ZERO_RANGE support
config: i386-randconfig-141-20260322 (https://download.01.org/0day-ci/archive/20260322/202603221252.dVVrrOrL-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
smatch: v0.5.0-9004-gb810ac53

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202603221252.dVVrrOrL-lkp@intel.com/

smatch warnings:
fs/exfat/file.c:183 exfat_fallocate() warn: inconsistent returns '&inode->i_rwsem'.

vim +183 fs/exfat/file.c

bf1797960c20f3d David Timber 2026-02-28  107  static long exfat_fallocate(struct file *file, int mode,
bf1797960c20f3d David Timber 2026-02-28  108  			  loff_t offset, loff_t len)
bf1797960c20f3d David Timber 2026-02-28  109  {
bf1797960c20f3d David Timber 2026-02-28  110  	struct inode *inode = file->f_mapping->host;
1178dacb657facf David Timber 2026-03-19  111  	loff_t newsize, isize;
bf1797960c20f3d David Timber 2026-02-28  112  	int err = 0;
bf1797960c20f3d David Timber 2026-02-28  113  
bf1797960c20f3d David Timber 2026-02-28  114  	/* No support for other modes */
1178dacb657facf David Timber 2026-03-19  115  	switch (mode) {
1178dacb657facf David Timber 2026-03-19  116  	case FALLOC_FL_ALLOCATE_RANGE:
1178dacb657facf David Timber 2026-03-19  117  	case FALLOC_FL_ZERO_RANGE:
1178dacb657facf David Timber 2026-03-19  118  	case FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE:
1178dacb657facf David Timber 2026-03-19  119  		break;
1178dacb657facf David Timber 2026-03-19  120  	default:
bf1797960c20f3d David Timber 2026-02-28  121  		return -EOPNOTSUPP;
1178dacb657facf David Timber 2026-03-19  122  	}
bf1797960c20f3d David Timber 2026-02-28  123  
bf1797960c20f3d David Timber 2026-02-28  124  	/* No support for dir */
bf1797960c20f3d David Timber 2026-02-28  125  	if (!S_ISREG(inode->i_mode))
1178dacb657facf David Timber 2026-03-19  126  		return mode & FALLOC_FL_ZERO_RANGE ? -EINVAL : -EOPNOTSUPP;
bf1797960c20f3d David Timber 2026-02-28  127  
bf1797960c20f3d David Timber 2026-02-28  128  	if (unlikely(exfat_forced_shutdown(inode->i_sb)))
bf1797960c20f3d David Timber 2026-02-28  129  		return -EIO;
bf1797960c20f3d David Timber 2026-02-28  130  
bf1797960c20f3d David Timber 2026-02-28  131  	inode_lock(inode);
                                                ^^^^^^^^^^^^^^^^^^

bf1797960c20f3d David Timber 2026-02-28  132  
1178dacb657facf David Timber 2026-03-19  133  	newsize = offset + len;
1178dacb657facf David Timber 2026-03-19  134  	isize = i_size_read(inode);
1178dacb657facf David Timber 2026-03-19  135  
1178dacb657facf David Timber 2026-03-19  136  	if (mode & FALLOC_FL_ZERO_RANGE) {
1178dacb657facf David Timber 2026-03-19  137  		struct exfat_inode_info *ei = EXFAT_I(inode);
1178dacb657facf David Timber 2026-03-19  138  		loff_t saved_validsize = ei->valid_size;
1178dacb657facf David Timber 2026-03-19  139  
1178dacb657facf David Timber 2026-03-19  140  		/* The requested range must span to or past EOF */
1178dacb657facf David Timber 2026-03-19  141  		if (newsize < isize) {
1178dacb657facf David Timber 2026-03-19  142  			err = -EOPNOTSUPP;
1178dacb657facf David Timber 2026-03-19  143  			goto error;
1178dacb657facf David Timber 2026-03-19  144  		}
1178dacb657facf David Timber 2026-03-19  145  
1178dacb657facf David Timber 2026-03-19  146  		/* valid_size can only be truncated */
1178dacb657facf David Timber 2026-03-19  147  		if (offset < ei->valid_size)
1178dacb657facf David Timber 2026-03-19  148  			ei->valid_size = offset;
1178dacb657facf David Timber 2026-03-19  149  		/* If offset >= ei->valid_size, the range is already zeroed so that'd be no-op */
1178dacb657facf David Timber 2026-03-19  150  
1178dacb657facf David Timber 2026-03-19  151  		if (!(mode & FALLOC_FL_KEEP_SIZE) && isize < newsize) {
1178dacb657facf David Timber 2026-03-19  152  			err = exfat_cont_expand(inode, newsize);
1178dacb657facf David Timber 2026-03-19  153  			if (err) {
1178dacb657facf David Timber 2026-03-19  154  				/* inode unchanged - revert valid_size */
1178dacb657facf David Timber 2026-03-19  155  				ei->valid_size = saved_validsize;
1178dacb657facf David Timber 2026-03-19  156  				goto error;
1178dacb657facf David Timber 2026-03-19  157  			}
1178dacb657facf David Timber 2026-03-19  158  			/* inode invalidated in exfat_cont_expand() */
1178dacb657facf David Timber 2026-03-19  159  		} else {
1178dacb657facf David Timber 2026-03-19  160  			/* update inode */
1178dacb657facf David Timber 2026-03-19  161  			inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
1178dacb657facf David Timber 2026-03-19  162  
1178dacb657facf David Timber 2026-03-19  163  			mark_inode_dirty(inode);
1178dacb657facf David Timber 2026-03-19  164  
1178dacb657facf David Timber 2026-03-19  165  			if (IS_SYNC(inode))
1178dacb657facf David Timber 2026-03-19  166  				return write_inode_now(inode, 1);

I don't think this calls inode_unlock(inode);

1178dacb657facf David Timber 2026-03-19  167  		}
1178dacb657facf David Timber 2026-03-19  168  
1178dacb657facf David Timber 2026-03-19  169  		/* drop cache after the new valid_size */
1178dacb657facf David Timber 2026-03-19  170  		if (ei->valid_size != saved_validsize)
1178dacb657facf David Timber 2026-03-19  171  			truncate_pagecache(inode, ei->valid_size);
1178dacb657facf David Timber 2026-03-19  172  	} else { /* mode == FALLOC_FL_ALLOCATE_RANGE */
1178dacb657facf David Timber 2026-03-19  173  		if (newsize <= isize)
bf1797960c20f3d David Timber 2026-02-28  174  			goto error;
bf1797960c20f3d David Timber 2026-02-28  175  
bf1797960c20f3d David Timber 2026-02-28  176  		/* This is just an expanding truncate */
bf1797960c20f3d David Timber 2026-02-28  177  		err = exfat_cont_expand(inode, newsize);
1178dacb657facf David Timber 2026-03-19  178  	}
bf1797960c20f3d David Timber 2026-02-28  179  
bf1797960c20f3d David Timber 2026-02-28  180  error:
bf1797960c20f3d David Timber 2026-02-28  181  	inode_unlock(inode);
bf1797960c20f3d David Timber 2026-02-28  182  
bf1797960c20f3d David Timber 2026-02-28 @183  	return err;
bf1797960c20f3d David Timber 2026-02-28  184  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


  reply	other threads:[~2026-03-23  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  4:35 [PATCH v0 0/1] exfat: add limited FALLOC_FL_ZERO_RANGE support David Timber
2026-03-19  4:35 ` [PATCH v0 1/1] " David Timber
2026-03-23  7:59   ` Dan Carpenter [this message]
2026-03-20  8:16 ` [syzbot ci] " syzbot ci
2026-03-22 12:35   ` David Timber
2026-03-22 12:38     ` syzbot ci

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=202603221252.dVVrrOrL-lkp@intel.com \
    --to=dan.carpenter@linaro.org \
    --cc=dxdt@dev.snart.me \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=sj1557.seo@samsung.com \
    --cc=yuezhang.mo@sony.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