From: kernel test robot <lkp@intel.com>
To: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Cc: kbuild-all@lists.01.org, Christoph Hellwig <hch@infradead.org>,
Amir Goldstein <amir73il@gmail.com>,
Dave Chinner <david@fromorbit.com>, Ted Tso <tytso@mit.edu>,
Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 10/12] shmem: Use invalidate_lock to protect fallocate
Date: Sat, 24 Apr 2021 03:27:45 +0800 [thread overview]
Message-ID: <202104240337.blcLX2eE-lkp@intel.com> (raw)
In-Reply-To: <20210423173018.23133-10-jack@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 9742 bytes --]
Hi Jan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on ext4/dev]
[also build test WARNING on fuse/for-next linus/master v5.12-rc8]
[cannot apply to hnaz-linux-mm/master next-20210423]
[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/Jan-Kara/fs-Hole-punch-vs-page-cache-filling-races/20210424-013114
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
config: s390-randconfig-s031-20210424 (attached as .config)
compiler: s390-linux-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
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/800cf89f11d437415eead2da969c3b07908fd406
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jan-Kara/fs-Hole-punch-vs-page-cache-filling-races/20210424-013114
git checkout 800cf89f11d437415eead2da969c3b07908fd406
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
mm/shmem.c: In function 'shmem_writepage':
>> mm/shmem.c:1326:10: warning: variable 'index' set but not used [-Wunused-but-set-variable]
1326 | pgoff_t index;
| ^~~~~
vim +/index +1326 mm/shmem.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 1316
^1da177e4c3f41 Linus Torvalds 2005-04-16 1317 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1318 * Move the page from the page cache to the swap cache.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1319 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1320 static int shmem_writepage(struct page *page, struct writeback_control *wbc)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1321 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1322 struct shmem_inode_info *info;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1323 struct address_space *mapping;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1324 struct inode *inode;
6922c0c7abd387 Hugh Dickins 2011-08-03 1325 swp_entry_t swap;
6922c0c7abd387 Hugh Dickins 2011-08-03 @1326 pgoff_t index;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1327
800d8c63b2e989 Kirill A. Shutemov 2016-07-26 1328 VM_BUG_ON_PAGE(PageCompound(page), page);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1329 BUG_ON(!PageLocked(page));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1330 mapping = page->mapping;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1331 index = page->index;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1332 inode = mapping->host;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1333 info = SHMEM_I(inode);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1334 if (info->flags & VM_LOCKED)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1335 goto redirty;
d9fe526a83b84e Hugh Dickins 2008-02-04 1336 if (!total_swap_pages)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1337 goto redirty;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1338
d9fe526a83b84e Hugh Dickins 2008-02-04 1339 /*
97b713ba3ebaa6 Christoph Hellwig 2015-01-14 1340 * Our capabilities prevent regular writeback or sync from ever calling
97b713ba3ebaa6 Christoph Hellwig 2015-01-14 1341 * shmem_writepage; but a stacking filesystem might use ->writepage of
97b713ba3ebaa6 Christoph Hellwig 2015-01-14 1342 * its underlying filesystem, in which case tmpfs should write out to
97b713ba3ebaa6 Christoph Hellwig 2015-01-14 1343 * swap only in response to memory pressure, and not for the writeback
97b713ba3ebaa6 Christoph Hellwig 2015-01-14 1344 * threads or sync.
d9fe526a83b84e Hugh Dickins 2008-02-04 1345 */
48f170fb7d7db8 Hugh Dickins 2011-07-25 1346 if (!wbc->for_reclaim) {
48f170fb7d7db8 Hugh Dickins 2011-07-25 1347 WARN_ON_ONCE(1); /* Still happens? Tell us about it! */
48f170fb7d7db8 Hugh Dickins 2011-07-25 1348 goto redirty;
48f170fb7d7db8 Hugh Dickins 2011-07-25 1349 }
1635f6a74152f1 Hugh Dickins 2012-05-29 1350
1635f6a74152f1 Hugh Dickins 2012-05-29 1351 /*
1635f6a74152f1 Hugh Dickins 2012-05-29 1352 * This is somewhat ridiculous, but without plumbing a SWAP_MAP_FALLOC
1635f6a74152f1 Hugh Dickins 2012-05-29 1353 * value into swapfile.c, the only way we can correctly account for a
1635f6a74152f1 Hugh Dickins 2012-05-29 1354 * fallocated page arriving here is now to initialize it and write it.
800cf89f11d437 Jan Kara 2021-04-23 1355 * Since a page added by currently running fallocate call cannot be
800cf89f11d437 Jan Kara 2021-04-23 1356 * dirtied and thus arrive here we know the fallocate has already
800cf89f11d437 Jan Kara 2021-04-23 1357 * completed and we are fine writing it out.
1635f6a74152f1 Hugh Dickins 2012-05-29 1358 */
1635f6a74152f1 Hugh Dickins 2012-05-29 1359 if (!PageUptodate(page)) {
1635f6a74152f1 Hugh Dickins 2012-05-29 1360 clear_highpage(page);
1635f6a74152f1 Hugh Dickins 2012-05-29 1361 flush_dcache_page(page);
1635f6a74152f1 Hugh Dickins 2012-05-29 1362 SetPageUptodate(page);
1635f6a74152f1 Hugh Dickins 2012-05-29 1363 }
1635f6a74152f1 Hugh Dickins 2012-05-29 1364
38d8b4e6bdc872 Huang Ying 2017-07-06 1365 swap = get_swap_page(page);
48f170fb7d7db8 Hugh Dickins 2011-07-25 1366 if (!swap.val)
48f170fb7d7db8 Hugh Dickins 2011-07-25 1367 goto redirty;
d9fe526a83b84e Hugh Dickins 2008-02-04 1368
b1dea800ac3959 Hugh Dickins 2011-05-11 1369 /*
b1dea800ac3959 Hugh Dickins 2011-05-11 1370 * Add inode to shmem_unuse()'s list of swapped-out inodes,
6922c0c7abd387 Hugh Dickins 2011-08-03 1371 * if it's not already there. Do it now before the page is
6922c0c7abd387 Hugh Dickins 2011-08-03 1372 * moved to swap cache, when its pagelock no longer protects
b1dea800ac3959 Hugh Dickins 2011-05-11 1373 * the inode from eviction. But don't unlock the mutex until
6922c0c7abd387 Hugh Dickins 2011-08-03 1374 * we've incremented swapped, because shmem_unuse_inode() will
6922c0c7abd387 Hugh Dickins 2011-08-03 1375 * prune a !swapped inode from the swaplist under this mutex.
b1dea800ac3959 Hugh Dickins 2011-05-11 1376 */
b1dea800ac3959 Hugh Dickins 2011-05-11 1377 mutex_lock(&shmem_swaplist_mutex);
05bf86b4ccfd0f Hugh Dickins 2011-05-14 1378 if (list_empty(&info->swaplist))
b56a2d8af9147a Vineeth Remanan Pillai 2019-03-05 1379 list_add(&info->swaplist, &shmem_swaplist);
b1dea800ac3959 Hugh Dickins 2011-05-11 1380
4afab1cd256e42 Yang Shi 2019-11-30 1381 if (add_to_swap_cache(page, swap,
3852f6768ede54 Joonsoo Kim 2020-08-11 1382 __GFP_HIGH | __GFP_NOMEMALLOC | __GFP_NOWARN,
3852f6768ede54 Joonsoo Kim 2020-08-11 1383 NULL) == 0) {
4595ef88d13613 Kirill A. Shutemov 2016-07-26 1384 spin_lock_irq(&info->lock);
6922c0c7abd387 Hugh Dickins 2011-08-03 1385 shmem_recalc_inode(inode);
267a4c76bbdb95 Hugh Dickins 2015-12-11 1386 info->swapped++;
4595ef88d13613 Kirill A. Shutemov 2016-07-26 1387 spin_unlock_irq(&info->lock);
6922c0c7abd387 Hugh Dickins 2011-08-03 1388
267a4c76bbdb95 Hugh Dickins 2015-12-11 1389 swap_shmem_alloc(swap);
267a4c76bbdb95 Hugh Dickins 2015-12-11 1390 shmem_delete_from_page_cache(page, swp_to_radix_entry(swap));
267a4c76bbdb95 Hugh Dickins 2015-12-11 1391
6922c0c7abd387 Hugh Dickins 2011-08-03 1392 mutex_unlock(&shmem_swaplist_mutex);
d9fe526a83b84e Hugh Dickins 2008-02-04 1393 BUG_ON(page_mapped(page));
9fab5619bdd7f8 Hugh Dickins 2009-03-31 1394 swap_writepage(page, wbc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1395 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1396 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1397
6922c0c7abd387 Hugh Dickins 2011-08-03 1398 mutex_unlock(&shmem_swaplist_mutex);
75f6d6d29a40b5 Minchan Kim 2017-07-06 1399 put_swap_page(page, swap);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1400 redirty:
^1da177e4c3f41 Linus Torvalds 2005-04-16 1401 set_page_dirty(page);
d9fe526a83b84e Hugh Dickins 2008-02-04 1402 if (wbc->for_reclaim)
d9fe526a83b84e Hugh Dickins 2008-02-04 1403 return AOP_WRITEPAGE_ACTIVATE; /* Return with page locked */
d9fe526a83b84e Hugh Dickins 2008-02-04 1404 unlock_page(page);
d9fe526a83b84e Hugh Dickins 2008-02-04 1405 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1406 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1407
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 14079 bytes --]
next prev parent reply other threads:[~2021-04-23 19:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 17:29 [PATCH 0/12 v4] fs: Hole punch vs page cache filling races Jan Kara
2021-04-23 17:29 ` [PATCH 01/12] mm: Fix comments mentioning i_mutex Jan Kara
2021-04-23 17:29 ` [PATCH 02/12] mm: Protect operations adding pages to page cache with invalidate_lock Jan Kara
2021-04-23 18:30 ` Matthew Wilcox
2021-04-23 23:04 ` Dave Chinner
2021-04-26 15:46 ` Jan Kara
2021-04-23 17:29 ` [PATCH 03/12] ext4: Convert to use mapping->invalidate_lock Jan Kara
2021-04-23 17:29 ` [PATCH 04/12] ext2: Convert to using invalidate_lock Jan Kara
2021-04-23 17:29 ` [PATCH 05/12] xfs: Convert to use invalidate_lock Jan Kara
2021-04-23 22:39 ` Dave Chinner
2021-04-23 17:29 ` [PATCH 06/12] zonefs: Convert to using invalidate_lock Jan Kara
2021-04-26 6:40 ` Damien Le Moal
2021-04-26 16:24 ` Jan Kara
2021-04-23 17:29 ` [PATCH 07/12] f2fs: " Jan Kara
2021-04-23 19:15 ` kernel test robot
2021-04-23 20:05 ` kernel test robot
2021-04-23 17:29 ` [PATCH 08/12] fuse: " Jan Kara
2021-04-23 17:29 ` [PATCH 09/12] shmem: " Jan Kara
2021-04-29 4:12 ` Hugh Dickins
2021-04-29 9:30 ` Jan Kara
2021-04-23 17:29 ` [PATCH 10/12] shmem: Use invalidate_lock to protect fallocate Jan Kara
2021-04-23 19:27 ` kernel test robot [this message]
2021-04-29 3:24 ` Hugh Dickins
2021-04-29 9:20 ` Jan Kara
2021-04-23 17:29 ` [PATCH 11/12] ceph: Fix race between hole punch and page fault Jan Kara
2021-04-23 17:29 ` [PATCH 12/12] cifs: " Jan Kara
2021-04-23 22:07 ` [PATCH 0/12 v4] fs: Hole punch vs page cache filling races Dave Chinner
2021-04-23 23:51 ` Matthew Wilcox
2021-04-24 6:11 ` Christoph Hellwig
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=202104240337.blcLX2eE-lkp@intel.com \
--to=lkp@intel.com \
--cc=amir73il@gmail.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=kbuild-all@lists.01.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).