All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
To: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: linux-nilfs@vger.kernel.org,
	DanCarpenter <dan.carpenter@oracle.com>,
	linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
Date: Wed, 24 Jul 2013 02:24:50 +0900 (JST)	[thread overview]
Message-ID: <20130724.022450.27782168.konishi.ryusuke@lab.ntt.co.jp> (raw)
In-Reply-To: <1374565611.2220.11.camel@slavad-ubuntu>

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

WARNING: multiple messages have this Message-ID (diff)
From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
To: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: linux-nilfs@vger.kernel.org,
	DanCarpenter <dan.carpenter@oracle.com>,
	linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
Date: Tue, 23 Jul 2013 17:24:50 +0000	[thread overview]
Message-ID: <20130724.022450.27782168.konishi.ryusuke@lab.ntt.co.jp> (raw)
In-Reply-To: <1374565611.2220.11.camel@slavad-ubuntu>

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

  reply	other threads:[~2013-07-23 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-07-23 17:24       ` Ryusuke Konishi

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=20130724.022450.27782168.konishi.ryusuke@lab.ntt.co.jp \
    --to=konishi.ryusuke@lab.ntt.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=slava@dubeyko.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 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.