public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] relay: move remove_buf_file inside relay_close_buf
Date: Sun, 28 Feb 2010 19:48:43 +0100	[thread overview]
Message-ID: <20100228184843.GK5768@kernel.dk> (raw)
In-Reply-To: <1267292137-12930-1-git-send-email-dmonakhov@openvz.org>

On Sat, Feb 27 2010, Dmitry Monakhov wrote:
> Currently remove_buf_file callback is called from from kobject
> release method. This result in follow issue:
> # blktrace -d /dev/sda1 -d /dev/sda -o test
> blktrace_setup()
>  dir = create_dir()
>  rchan = relay_open(dir,...)
>  ->create_buf_file_callback
>     buf_file  = debugfs_create_file(dir, )
> 
> Userspace will open buf_file.
> Later we make a decision to stop tracing
> blktrace_down()
>   relay_close(rhcan)  /* just decrement kobj reference  */
>                       /* since it is not zero then callback not called */
>   debugfs_remove(dir) /* FAIL due to non empty dir   */
> 
> Later user space will close the file and file will be deleted,
> but directory still exist.
> user_space_close()
>  ->file_release
>    ->release_buf_file_callback
>      ->debugfs_remove(buf_file)
> 
> In fact this is general issue, blktrace is just one of examples.
> We can not reliably remove parent dir until all users close the
> buf_file.
> 
> We don't have to wait this long. File may be deleted
> inside relay_close_buf().

Thanks, I believe this fixes a long standing problem we've had with
blktrace. You can add my acked-by.

-- 
Jens Axboe


  reply	other threads:[~2010-02-28 18:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-27 17:35 [PATCH] relay: move remove_buf_file inside relay_close_buf Dmitry Monakhov
2010-02-28 18:48 ` Jens Axboe [this message]
2010-04-06  9:34 ` Dmitry Monakhov
2010-04-07  5:24   ` Tom Zanussi
  -- strict thread matches above, loose matches on Subject: below --
2013-04-22  7:57 Dmitry Monakhov

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=20100228184843.GK5768@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=dmonakhov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    /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