From: Rong Chen <rong.a.chen@intel.com> To: Song Liu <songliubraving@fb.com>, Xiao Ni <xni@redhat.com> Cc: kernel test robot <lkp@intel.com>, "kbuild-all@lists.01.org" <kbuild-all@lists.01.org>, "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org> Subject: Re: [kbuild-all] Re: [song-md:md-next 5/6] drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1532. Date: Tue, 16 Mar 2021 15:01:28 +0800 [thread overview] Message-ID: <85f3998d-82a8-095a-951d-04c141e0beef@intel.com> (raw) In-Reply-To: <3EE962E0-8054-4460-8EEB-0338EE5C1940@fb.com> On 3/16/21 2:56 PM, Song Liu wrote: > >> On Mar 15, 2021, at 7:29 PM, Xiao Ni <xni@redhat.com> wrote: >> >> Hi all >> >> The atomic_t r10_bio->remaining starts at 1 in raid10_handle_discard. It means >> raid10_handle_discard uses it and sets it to 1. So in fact it starts at 0 and sets to 1 >> when it's used at first time. Then r10_bio->remaining is added by atomic_inc per usage. >> >> It decrements the value when leaving raid10_handle_discard and in every callback function. >> So the count of r10_bio->remaining in this patch is right. >> >> Regards >> Xiao > It does look like a false alarm, as we set r10bio to first_r10bio after > the free. > > Thanks, > Song Hi all, Thanks for the clarification, we have disabled such warning. Best Regards, Rong Chen > >> On 03/16/2021 08:29 AM, kernel test robot wrote: >>> tree: git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next >>> head: 49c4d345c81f149a29b3db6e521e5191e55f02b6 >>> commit: f3cf8c2b2caf6ae77b7c786218d3b060faef63a6 [5/6] md/raid10: improve discard request for far layout >>> config: x86_64-allyesconfig (attached as .config) >>> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 >>> >>> If you fix the issue, kindly add following tag as appropriate >>> Reported-by: kernel test robot <lkp@intel.com> >>> >>> >>> "coccinelle warnings: (new ones prefixed by >>)" >>>>> drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1532. >>> drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1537. >>> >>> vim +1526 drivers/md/raid10.c >>> >>> 1520 >>> 1521 static void raid_end_discard_bio(struct r10bio *r10bio) >>> 1522 { >>> 1523 struct r10conf *conf = r10bio->mddev->private; >>> 1524 struct r10bio *first_r10bio; >>> 1525 >>>> 1526 while (atomic_dec_and_test(&r10bio->remaining)) { >>> 1527 >>> 1528 allow_barrier(conf); >>> 1529 >>> 1530 if (!test_bit(R10BIO_Discard, &r10bio->state)) { >>> 1531 first_r10bio = (struct r10bio *)r10bio->master_bio; >>>> 1532 free_r10bio(r10bio); >>> 1533 r10bio = first_r10bio; >>> 1534 } else { >>> 1535 md_write_end(r10bio->mddev); >>> 1536 bio_endio(r10bio->master_bio); >>> 1537 free_r10bio(r10bio); >>> 1538 break; >>> 1539 } >>> 1540 } >>> 1541 } >>> 1542 >>> >>> --- >>> 0-DAY CI Kernel Test Service, Intel Corporation >>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org > _______________________________________________ > kbuild-all mailing list -- kbuild-all@lists.01.org > To unsubscribe send an email to kbuild-all-leave@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Rong Chen <rong.a.chen@intel.com> To: kbuild-all@lists.01.org Subject: Re: [song-md:md-next 5/6] drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1532. Date: Tue, 16 Mar 2021 15:01:28 +0800 [thread overview] Message-ID: <85f3998d-82a8-095a-951d-04c141e0beef@intel.com> (raw) In-Reply-To: <3EE962E0-8054-4460-8EEB-0338EE5C1940@fb.com> [-- Attachment #1: Type: text/plain, Size: 2728 bytes --] On 3/16/21 2:56 PM, Song Liu wrote: > >> On Mar 15, 2021, at 7:29 PM, Xiao Ni <xni@redhat.com> wrote: >> >> Hi all >> >> The atomic_t r10_bio->remaining starts at 1 in raid10_handle_discard. It means >> raid10_handle_discard uses it and sets it to 1. So in fact it starts at 0 and sets to 1 >> when it's used at first time. Then r10_bio->remaining is added by atomic_inc per usage. >> >> It decrements the value when leaving raid10_handle_discard and in every callback function. >> So the count of r10_bio->remaining in this patch is right. >> >> Regards >> Xiao > It does look like a false alarm, as we set r10bio to first_r10bio after > the free. > > Thanks, > Song Hi all, Thanks for the clarification, we have disabled such warning. Best Regards, Rong Chen > >> On 03/16/2021 08:29 AM, kernel test robot wrote: >>> tree: git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next >>> head: 49c4d345c81f149a29b3db6e521e5191e55f02b6 >>> commit: f3cf8c2b2caf6ae77b7c786218d3b060faef63a6 [5/6] md/raid10: improve discard request for far layout >>> config: x86_64-allyesconfig (attached as .config) >>> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 >>> >>> If you fix the issue, kindly add following tag as appropriate >>> Reported-by: kernel test robot <lkp@intel.com> >>> >>> >>> "coccinelle warnings: (new ones prefixed by >>)" >>>>> drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1532. >>> drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1537. >>> >>> vim +1526 drivers/md/raid10.c >>> >>> 1520 >>> 1521 static void raid_end_discard_bio(struct r10bio *r10bio) >>> 1522 { >>> 1523 struct r10conf *conf = r10bio->mddev->private; >>> 1524 struct r10bio *first_r10bio; >>> 1525 >>>> 1526 while (atomic_dec_and_test(&r10bio->remaining)) { >>> 1527 >>> 1528 allow_barrier(conf); >>> 1529 >>> 1530 if (!test_bit(R10BIO_Discard, &r10bio->state)) { >>> 1531 first_r10bio = (struct r10bio *)r10bio->master_bio; >>>> 1532 free_r10bio(r10bio); >>> 1533 r10bio = first_r10bio; >>> 1534 } else { >>> 1535 md_write_end(r10bio->mddev); >>> 1536 bio_endio(r10bio->master_bio); >>> 1537 free_r10bio(r10bio); >>> 1538 break; >>> 1539 } >>> 1540 } >>> 1541 } >>> 1542 >>> >>> --- >>> 0-DAY CI Kernel Test Service, Intel Corporation >>> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org > _______________________________________________ > kbuild-all mailing list -- kbuild-all(a)lists.01.org > To unsubscribe send an email to kbuild-all-leave(a)lists.01.org
next prev parent reply other threads:[~2021-03-16 7:03 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-16 0:29 [song-md:md-next 5/6] drivers/md/raid10.c:1526:8-27: atomic_dec_and_test variation before object free at line 1532 kernel test robot 2021-03-16 0:29 ` kernel test robot 2021-03-16 2:29 ` Xiao Ni 2021-03-16 2:29 ` Xiao Ni 2021-03-16 6:56 ` Song Liu 2021-03-16 6:56 ` Song Liu 2021-03-16 7:01 ` Rong Chen [this message] 2021-03-16 7:01 ` Rong Chen
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=85f3998d-82a8-095a-951d-04c141e0beef@intel.com \ --to=rong.a.chen@intel.com \ --cc=kbuild-all@lists.01.org \ --cc=linux-raid@vger.kernel.org \ --cc=lkp@intel.com \ --cc=songliubraving@fb.com \ --cc=xni@redhat.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.