* [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
@ 2013-07-22 8:02 ` Vyacheslav Dubeyko
0 siblings, 0 replies; 8+ messages in thread
From: Vyacheslav Dubeyko @ 2013-07-22 8:02 UTC (permalink / raw)
To: linux-nilfs
Cc: KONISHI Ryusuke, DanCarpenter, Linux FS Devel,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Andrew Morton
From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
This patch removes double call of bio_put() in nilfs_end_bio_write()
for the case of BIO_EOPNOTSUPP error detection. The issue was found
by Dan Carpenter and he suggests first version of the fix too.
Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
CC: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
---
fs/nilfs2/segbuf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index dc9a913..5bacf46 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
if (err == -EOPNOTSUPP) {
set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
- bio_put(bio);
- /* to be detected by submit_seg_bio() */
+ /* to be detected by nilfs_segbuf_submit_bio() */
}
if (!uptodate)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
@ 2013-07-22 8:02 ` Vyacheslav Dubeyko
0 siblings, 0 replies; 8+ messages in thread
From: Vyacheslav Dubeyko @ 2013-07-22 8:02 UTC (permalink / raw)
To: linux-nilfs
Cc: KONISHI Ryusuke, DanCarpenter, Linux FS Devel,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Andrew Morton
From: Vyacheslav Dubeyko <slava@dubeyko.com>
Subject: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
This patch removes double call of bio_put() in nilfs_end_bio_write()
for the case of BIO_EOPNOTSUPP error detection. The issue was found
by Dan Carpenter and he suggests first version of the fix too.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
CC: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
---
fs/nilfs2/segbuf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index dc9a913..5bacf46 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
if (err = -EOPNOTSUPP) {
set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
- bio_put(bio);
- /* to be detected by submit_seg_bio() */
+ /* to be detected by nilfs_segbuf_submit_bio() */
}
if (!uptodate)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
2013-07-22 8:02 ` Vyacheslav Dubeyko
@ 2013-07-22 18:24 ` Ryusuke Konishi
-1 siblings, 0 replies; 8+ messages in thread
From: Ryusuke Konishi @ 2013-07-22 18:24 UTC (permalink / raw)
To: Vyacheslav Dubeyko
Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA, DanCarpenter,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
Hi Vyacheslav,
On Mon, 22 Jul 2013 12:02:14 +0400, Vyacheslav Dubeyko wrote:
> From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
> Subject: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
>
> This patch removes double call of bio_put() in nilfs_end_bio_write()
> for the case of BIO_EOPNOTSUPP error detection. The issue was found
> by Dan Carpenter and he suggests first version of the fix too.
>
> Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
> CC: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
Thank you for following the issue. I reviewed the code around bio.
In conclusion, Dan Carpenter's patch looks correct because
nilfs_segbuf_submit_bio() does not increment the number of flying bio
(segbuf->sb_nbio) for EOPNOTSUPP/BIO_EOPNOTSUPP case.
If nilfs_end_bio_write() function reaches the complete() call for the
EOPNOTSUPP/BIO_EOPNOTSUPP case (as the current implementation), the
number of complete() calls and that of wait_for_complete() will not
balance.
Do you have a comment?
Regards,
Ryusuke Konishi
> ---
> fs/nilfs2/segbuf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
> index dc9a913..5bacf46 100644
> --- a/fs/nilfs2/segbuf.c
> +++ b/fs/nilfs2/segbuf.c
> @@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
>
> if (err == -EOPNOTSUPP) {
> set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
> - bio_put(bio);
> - /* to be detected by submit_seg_bio() */
> + /* to be detected by nilfs_segbuf_submit_bio() */
> }
>
> if (!uptodate)
> --
> 1.7.9.5
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
@ 2013-07-22 18:24 ` Ryusuke Konishi
0 siblings, 0 replies; 8+ messages in thread
From: Ryusuke Konishi @ 2013-07-22 18:24 UTC (permalink / raw)
To: Vyacheslav Dubeyko
Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA, DanCarpenter,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
Hi Vyacheslav,
On Mon, 22 Jul 2013 12:02:14 +0400, Vyacheslav Dubeyko wrote:
> From: Vyacheslav Dubeyko <slava@dubeyko.com>
> Subject: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
>
> This patch removes double call of bio_put() in nilfs_end_bio_write()
> for the case of BIO_EOPNOTSUPP error detection. The issue was found
> by Dan Carpenter and he suggests first version of the fix too.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
> CC: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Thank you for following the issue. I reviewed the code around bio.
In conclusion, Dan Carpenter's patch looks correct because
nilfs_segbuf_submit_bio() does not increment the number of flying bio
(segbuf->sb_nbio) for EOPNOTSUPP/BIO_EOPNOTSUPP case.
If nilfs_end_bio_write() function reaches the complete() call for the
EOPNOTSUPP/BIO_EOPNOTSUPP case (as the current implementation), the
number of complete() calls and that of wait_for_complete() will not
balance.
Do you have a comment?
Regards,
Ryusuke Konishi
> ---
> fs/nilfs2/segbuf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
> index dc9a913..5bacf46 100644
> --- a/fs/nilfs2/segbuf.c
> +++ b/fs/nilfs2/segbuf.c
> @@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
>
> if (err = -EOPNOTSUPP) {
> set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
> - bio_put(bio);
> - /* to be detected by submit_seg_bio() */
> + /* to be detected by nilfs_segbuf_submit_bio() */
> }
>
> if (!uptodate)
> --
> 1.7.9.5
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
2013-07-22 18:24 ` Ryusuke Konishi
@ 2013-07-23 7:46 ` Vyacheslav Dubeyko
-1 siblings, 0 replies; 8+ messages in thread
From: Vyacheslav Dubeyko @ 2013-07-23 7:46 UTC (permalink / raw)
To: Ryusuke Konishi
Cc: linux-nilfs, DanCarpenter, linux-fsdevel, kernel-janitors, akpm
Hi Ryusuke,
On Tue, 2013-07-23 at 03:24 +0900, Ryusuke Konishi wrote:
[snip]
>
> Thank you for following the issue. I reviewed the code around bio.
>
> In conclusion, Dan Carpenter's patch looks correct because
> nilfs_segbuf_submit_bio() does not increment the number of flying bio
> (segbuf->sb_nbio) for EOPNOTSUPP/BIO_EOPNOTSUPP case.
>
I worry that nilfs_end_bio_write() is called asynchronously. And, as I
understand, the BIO_EOPNOTSUPP flag is set during nilfs_end_bio_write()
call. It means for me that sometimes segbuf->sb_nbio will be not
incremented in nilfs_segbuf_submit_bio() but sometimes this field can be
incremented and for BIO_EOPNOTSUPP case.
> If nilfs_end_bio_write() function reaches the complete() call for the
> EOPNOTSUPP/BIO_EOPNOTSUPP case (as the current implementation), the
> number of complete() calls and that of wait_for_complete() will not
> balance.
>
I think that it is dangerous to return without complete() call because
of asynchronous nature of nilfs_end_bio_write() call.
What do you think?
With the best regards,
Vyacheslav Dubeyko.
> Do you have a comment?
>
> Regards,
> Ryusuke Konishi
>
> > ---
> > fs/nilfs2/segbuf.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
> > index dc9a913..5bacf46 100644
> > --- a/fs/nilfs2/segbuf.c
> > +++ b/fs/nilfs2/segbuf.c
> > @@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
> >
> > if (err == -EOPNOTSUPP) {
> > set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
> > - bio_put(bio);
> > - /* to be detected by submit_seg_bio() */
> > + /* to be detected by nilfs_segbuf_submit_bio() */
> > }
> >
> > if (!uptodate)
> > --
> > 1.7.9.5
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
@ 2013-07-23 7:46 ` Vyacheslav Dubeyko
0 siblings, 0 replies; 8+ messages in thread
From: Vyacheslav Dubeyko @ 2013-07-23 7:46 UTC (permalink / raw)
To: Ryusuke Konishi
Cc: linux-nilfs, DanCarpenter, linux-fsdevel, kernel-janitors, akpm
Hi Ryusuke,
On Tue, 2013-07-23 at 03:24 +0900, Ryusuke Konishi wrote:
[snip]
>
> Thank you for following the issue. I reviewed the code around bio.
>
> In conclusion, Dan Carpenter's patch looks correct because
> nilfs_segbuf_submit_bio() does not increment the number of flying bio
> (segbuf->sb_nbio) for EOPNOTSUPP/BIO_EOPNOTSUPP case.
>
I worry that nilfs_end_bio_write() is called asynchronously. And, as I
understand, the BIO_EOPNOTSUPP flag is set during nilfs_end_bio_write()
call. It means for me that sometimes segbuf->sb_nbio will be not
incremented in nilfs_segbuf_submit_bio() but sometimes this field can be
incremented and for BIO_EOPNOTSUPP case.
> If nilfs_end_bio_write() function reaches the complete() call for the
> EOPNOTSUPP/BIO_EOPNOTSUPP case (as the current implementation), the
> number of complete() calls and that of wait_for_complete() will not
> balance.
>
I think that it is dangerous to return without complete() call because
of asynchronous nature of nilfs_end_bio_write() call.
What do you think?
With the best regards,
Vyacheslav Dubeyko.
> Do you have a comment?
>
> Regards,
> Ryusuke Konishi
>
> > ---
> > fs/nilfs2/segbuf.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
> > index dc9a913..5bacf46 100644
> > --- a/fs/nilfs2/segbuf.c
> > +++ b/fs/nilfs2/segbuf.c
> > @@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
> >
> > if (err = -EOPNOTSUPP) {
> > set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
> > - bio_put(bio);
> > - /* to be detected by submit_seg_bio() */
> > + /* to be detected by nilfs_segbuf_submit_bio() */
> > }
> >
> > if (!uptodate)
> > --
> > 1.7.9.5
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
2013-07-23 7:46 ` Vyacheslav Dubeyko
@ 2013-07-23 17:24 ` Ryusuke Konishi
-1 siblings, 0 replies; 8+ messages in thread
From: Ryusuke Konishi @ 2013-07-23 17:24 UTC (permalink / raw)
To: Vyacheslav Dubeyko
Cc: linux-nilfs, DanCarpenter, linux-fsdevel, kernel-janitors, akpm
On Tue, 23 Jul 2013 11:46:51 +0400, Vyacheslav Dubeyko wrote:
> Hi Ryusuke,
>
> On Tue, 2013-07-23 at 03:24 +0900, Ryusuke Konishi wrote:
>
> [snip]
>>
>> Thank you for following the issue. I reviewed the code around bio.
>>
>> In conclusion, Dan Carpenter's patch looks correct because
>> nilfs_segbuf_submit_bio() does not increment the number of flying bio
>> (segbuf->sb_nbio) for EOPNOTSUPP/BIO_EOPNOTSUPP case.
>>
>
> I worry that nilfs_end_bio_write() is called asynchronously. And, as I
> understand, the BIO_EOPNOTSUPP flag is set during nilfs_end_bio_write()
> call. It means for me that sometimes segbuf->sb_nbio will be not
> incremented in nilfs_segbuf_submit_bio() but sometimes this field can be
> incremented and for BIO_EOPNOTSUPP case.
>
>> If nilfs_end_bio_write() function reaches the complete() call for the
>> EOPNOTSUPP/BIO_EOPNOTSUPP case (as the current implementation), the
>> number of complete() calls and that of wait_for_complete() will not
>> balance.
>>
>
> I think that it is dangerous to return without complete() call because
> of asynchronous nature of nilfs_end_bio_write() call.
>
> What do you think?
nilfs_end_bio_write() may be called either synchronously or
asynchronously as bio->bi_end_io(). It may be called when
submit_bio() fails or when bio is terminated asynchronously.
Yes, the current nilfs_end_bio_write() implementation is confusing
and dangerous for the EOPNOTSUPP case.
I think nilfs_end_bio_write() should be modified so that
segbuf->sb_nbio is incremented in either case.
Thanks,
Ryusuke Konishi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
@ 2013-07-23 17:24 ` Ryusuke Konishi
0 siblings, 0 replies; 8+ messages in thread
From: Ryusuke Konishi @ 2013-07-23 17:24 UTC (permalink / raw)
To: Vyacheslav Dubeyko
Cc: linux-nilfs, DanCarpenter, linux-fsdevel, kernel-janitors, akpm
On Tue, 23 Jul 2013 11:46:51 +0400, Vyacheslav Dubeyko wrote:
> Hi Ryusuke,
>
> On Tue, 2013-07-23 at 03:24 +0900, Ryusuke Konishi wrote:
>
> [snip]
>>
>> Thank you for following the issue. I reviewed the code around bio.
>>
>> In conclusion, Dan Carpenter's patch looks correct because
>> nilfs_segbuf_submit_bio() does not increment the number of flying bio
>> (segbuf->sb_nbio) for EOPNOTSUPP/BIO_EOPNOTSUPP case.
>>
>
> I worry that nilfs_end_bio_write() is called asynchronously. And, as I
> understand, the BIO_EOPNOTSUPP flag is set during nilfs_end_bio_write()
> call. It means for me that sometimes segbuf->sb_nbio will be not
> incremented in nilfs_segbuf_submit_bio() but sometimes this field can be
> incremented and for BIO_EOPNOTSUPP case.
>
>> If nilfs_end_bio_write() function reaches the complete() call for the
>> EOPNOTSUPP/BIO_EOPNOTSUPP case (as the current implementation), the
>> number of complete() calls and that of wait_for_complete() will not
>> balance.
>>
>
> I think that it is dangerous to return without complete() call because
> of asynchronous nature of nilfs_end_bio_write() call.
>
> What do you think?
nilfs_end_bio_write() may be called either synchronously or
asynchronously as bio->bi_end_io(). It may be called when
submit_bio() fails or when bio is terminated asynchronously.
Yes, the current nilfs_end_bio_write() implementation is confusing
and dangerous for the EOPNOTSUPP case.
I think nilfs_end_bio_write() should be modified so that
segbuf->sb_nbio is incremented in either case.
Thanks,
Ryusuke Konishi
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-07-23 17:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 8:02 [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error Vyacheslav Dubeyko
2013-07-22 8:02 ` Vyacheslav Dubeyko
2013-07-22 18:24 ` Ryusuke Konishi
2013-07-22 18:24 ` Ryusuke Konishi
2013-07-23 7:46 ` Vyacheslav Dubeyko
2013-07-23 7:46 ` Vyacheslav Dubeyko
2013-07-23 17:24 ` Ryusuke Konishi
2013-07-23 17:24 ` Ryusuke Konishi
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.