[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100228184843.GK5768@kernel.dk>
Date: Sun, 28 Feb 2010 19:48:43 +0100
From: Jens Axboe <jens.axboe@...cle.com>
To: Dmitry Monakhov <dmonakhov@...nvz.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] relay: move remove_buf_file inside relay_close_buf
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists