From: Dan Carpenter <[email protected]>
To: [email protected], David Howells <[email protected]>
Cc: [email protected], [email protected],
GNU/Weeb Mailing List <[email protected]>,
[email protected]
Subject: [ammarfaizi2-block:dhowells/linux-fs/netfs-linked-list 61/61] fs/netfs/buffered_flush.c:1072 netfs_select_dirty() warn: inconsistent returns '&ctx->dirty_lock'.
Date: Mon, 4 Jul 2022 16:30:17 +0300 [thread overview]
Message-ID: <[email protected]> (raw)
tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-linked-list
head: ce4670495468b797b0c5927fcb661bc0da48b9ab
commit: ce4670495468b797b0c5927fcb661bc0da48b9ab [61/61] netfs: Add a struct to group modifications together and flushed in order
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220703/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
New smatch warnings:
fs/netfs/buffered_flush.c:1072 netfs_select_dirty() warn: inconsistent returns '&ctx->dirty_lock'.
vim +1072 fs/netfs/buffered_flush.c
2dc27084e13c291 David Howells 2021-06-29 980 static int netfs_select_dirty(struct netfs_io_request *wreq,
2dc27084e13c291 David Howells 2021-06-29 981 struct writeback_control *wbc,
2dc27084e13c291 David Howells 2021-06-29 982 struct netfs_inode *ctx,
2dc27084e13c291 David Howells 2021-06-29 983 pgoff_t *_first, pgoff_t last)
2dc27084e13c291 David Howells 2021-06-29 984 {
2dc27084e13c291 David Howells 2021-06-29 985 struct netfs_dirty_region *region;
ce4670495468b79 David Howells 2022-02-07 986 struct netfs_flush_group *group;
2dc27084e13c291 David Howells 2021-06-29 987 pgoff_t first = *_first;
2dc27084e13c291 David Howells 2021-06-29 988 pgoff_t csize = 1UL << ctx->cache_order;
ce4670495468b79 David Howells 2022-02-07 989 bool advance = true;
2dc27084e13c291 David Howells 2021-06-29 990 int ret;
2dc27084e13c291 David Howells 2021-06-29 991
2dc27084e13c291 David Howells 2021-06-29 992 /* Round out the range we're looking through to accommodate whole cache
2dc27084e13c291 David Howells 2021-06-29 993 * blocks. The cache may only be able to store blocks of that size, in
2dc27084e13c291 David Howells 2021-06-29 994 * which case we may need to add non-dirty pages to the buffer too.
2dc27084e13c291 David Howells 2021-06-29 995 */
2dc27084e13c291 David Howells 2021-06-29 996 if (ctx->cache_order) {
2dc27084e13c291 David Howells 2021-06-29 997 first = round_down(first, csize);
2dc27084e13c291 David Howells 2021-06-29 998 last = round_up_incl(last, csize);
2dc27084e13c291 David Howells 2021-06-29 999 }
2dc27084e13c291 David Howells 2021-06-29 1000
2dc27084e13c291 David Howells 2021-06-29 1001 _enter("%lx-%lx", first, last);
2dc27084e13c291 David Howells 2021-06-29 1002
2dc27084e13c291 David Howells 2021-06-29 1003 if (wbc->sync_mode == WB_SYNC_NONE) {
2dc27084e13c291 David Howells 2021-06-29 1004 if (!mutex_trylock(&ctx->wb_mutex))
2dc27084e13c291 David Howells 2021-06-29 1005 return 0;
2dc27084e13c291 David Howells 2021-06-29 1006 } else {
2dc27084e13c291 David Howells 2021-06-29 1007 mutex_lock(&ctx->wb_mutex);
2dc27084e13c291 David Howells 2021-06-29 1008 }
2dc27084e13c291 David Howells 2021-06-29 1009
2dc27084e13c291 David Howells 2021-06-29 1010 /* Find the first dirty region that overlaps the requested range */
2dc27084e13c291 David Howells 2021-06-29 1011 spin_lock(&ctx->dirty_lock);
ce4670495468b79 David Howells 2022-02-07 1012
2dc27084e13c291 David Howells 2021-06-29 1013 region = netfs_scan_for_region(ctx, first, last);
ce4670495468b79 David Howells 2022-02-07 1014 if (region)
ce4670495468b79 David Howells 2022-02-07 1015 kdebug("scan got D=%08x", region->debug_id);
ce4670495468b79 David Howells 2022-02-07 1016
ce4670495468b79 David Howells 2022-02-07 1017 /* If the region selected is not in the bottommost flush group, we need
ce4670495468b79 David Howells 2022-02-07 1018 * to flush prerequisites first.
ce4670495468b79 David Howells 2022-02-07 1019 */
ce4670495468b79 David Howells 2022-02-07 1020 if (region && region->group) {
ce4670495468b79 David Howells 2022-02-07 1021 group = list_first_entry(&ctx->flush_groups,
ce4670495468b79 David Howells 2022-02-07 1022 struct netfs_flush_group, group_link);
ce4670495468b79 David Howells 2022-02-07 1023 if (region->group != group) {
ce4670495468b79 David Howells 2022-02-07 1024 kdebug("flush prereq");
ce4670495468b79 David Howells 2022-02-07 1025 region = netfs_select_from_flush_group(wbc, ctx, group);
ce4670495468b79 David Howells 2022-02-07 1026 if (IS_ERR(region)) {
ce4670495468b79 David Howells 2022-02-07 1027 ret = PTR_ERR(region);
ce4670495468b79 David Howells 2022-02-07 1028 goto unlock;
spin_unlock(&ctx->dirty_lock);
ce4670495468b79 David Howells 2022-02-07 1029 }
ce4670495468b79 David Howells 2022-02-07 1030 advance = false;
ce4670495468b79 David Howells 2022-02-07 1031 }
2dc27084e13c291 David Howells 2021-06-29 1032 }
ce4670495468b79 David Howells 2022-02-07 1033
ce4670495468b79 David Howells 2022-02-07 1034 if (region)
ce4670495468b79 David Howells 2022-02-07 1035 netfs_get_dirty_region(ctx, region, netfs_region_trace_get_wback);
ce4670495468b79 David Howells 2022-02-07 1036
2dc27084e13c291 David Howells 2021-06-29 1037 spin_unlock(&ctx->dirty_lock);
2dc27084e13c291 David Howells 2021-06-29 1038 if (!region) {
2dc27084e13c291 David Howells 2021-06-29 1039 _debug("scan failed");
2dc27084e13c291 David Howells 2021-06-29 1040 *_first = last;
2dc27084e13c291 David Howells 2021-06-29 1041 ret = 0;
2dc27084e13c291 David Howells 2021-06-29 1042 goto unlock;
2dc27084e13c291 David Howells 2021-06-29 1043 }
2dc27084e13c291 David Howells 2021-06-29 1044
2dc27084e13c291 David Howells 2021-06-29 1045 /* Try to grab the first folio of the requested range within that
2dc27084e13c291 David Howells 2021-06-29 1046 * region.
2dc27084e13c291 David Howells 2021-06-29 1047 */
2dc27084e13c291 David Howells 2021-06-29 1048 if (*_first < region->first)
2dc27084e13c291 David Howells 2021-06-29 1049 *_first = region->first;
ce4670495468b79 David Howells 2022-02-07 1050
2dc27084e13c291 David Howells 2021-06-29 1051 ret = netfs_find_writeback_start(wreq, wbc, region, _first, last);
2dc27084e13c291 David Howells 2021-06-29 1052 if (ret <= 0)
ce4670495468b79 David Howells 2022-02-07 1053 goto put_region;
2dc27084e13c291 David Howells 2021-06-29 1054
2dc27084e13c291 David Howells 2021-06-29 1055 netfs_extend_writeback(wreq, wbc, ctx, region);
ce4670495468b79 David Howells 2022-02-07 1056 if (advance)
2dc27084e13c291 David Howells 2021-06-29 1057 *_first = wreq->last + 1;
2dc27084e13c291 David Howells 2021-06-29 1058
2dc27084e13c291 David Howells 2021-06-29 1059 netfs_split_out_regions(wreq, ctx, region);
2dc27084e13c291 David Howells 2021-06-29 1060
2dc27084e13c291 David Howells 2021-06-29 1061 /* The assembled write request gets placed on the list to prevent
2dc27084e13c291 David Howells 2021-06-29 1062 * conflicting write requests happening simultaneously.
2dc27084e13c291 David Howells 2021-06-29 1063 */
2dc27084e13c291 David Howells 2021-06-29 1064 netfs_add_wback_to_list(ctx, wreq);
2dc27084e13c291 David Howells 2021-06-29 1065 ret = 1;
2dc27084e13c291 David Howells 2021-06-29 1066
ce4670495468b79 David Howells 2022-02-07 1067 put_region:
ce4670495468b79 David Howells 2022-02-07 1068 netfs_put_dirty_region(ctx, region, netfs_region_trace_put_wback);
2dc27084e13c291 David Howells 2021-06-29 1069 unlock:
2dc27084e13c291 David Howells 2021-06-29 1070 mutex_unlock(&ctx->wb_mutex);
2dc27084e13c291 David Howells 2021-06-29 1071 _leave(" = %d [%lx]", ret, *_first);
2dc27084e13c291 David Howells 2021-06-29 @1072 return ret;
2dc27084e13c291 David Howells 2021-06-29 1073 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
reply other threads:[~2022-07-04 13:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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