All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Zhi Yong Wu <zwu.kernel@gmail.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	sekharan@us.ibm.com, Ram Pai <linuxram@us.ibm.com>,
	Dave Chinner <david@fromorbit.com>,
	chris.mason@fusionio.com, jbacik@fusionio.com,
	Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Subject: Re: [PATCH v3 00/13] VFS hot tracking
Date: Wed, 3 Jul 2013 14:30:51 +0100	[thread overview]
Message-ID: <20130703133051.GL4165@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAEH94LiHrz87CMiyDqhJQTqa41goV6a-c3twArUtnSAPVydt5A@mail.gmail.com>

On Mon, Jul 01, 2013 at 09:19:08PM +0800, Zhi Yong Wu wrote:

> >         * lookups (both for inode and range) leak on race with unlink.
> > You grab a reference, drop the lock, check if HOT_DELETING is set and
> > return an error if it is; how the hell could the caller possibly undo
> > that reference grab, when it has no idea what object had been grabbed
> I don't get what you mean, do you elaborate it with more details?
> which caller? which scenario will it take place in?

Sigh...  Suppose that test has failed and you've returned ERR_PTR(-ENOENT).
If that ever happens (and I don't see what would prevent that, seeing
that e.g. unlink(2) can happen at any point, that you are not holding any
locks at that point and that unlink(2) wouldn't care for any of your locks
anyway) you are going to have a leak - you've grabbed a reference a few
lines above and once you return, there's no way to tell which object had
been grabbed, let alone do the matching kref_put().

> > debugfs-related issues - debugfs is completely unsuitable for dynamic
> > objects and you step into that big way, in addition to races of your
> **** Is debugfs also completely unsuitable for dynamic objects even
> though we fix the following issues listed by you? Do you have any
> better way about this?

The last issue in that list (IO hours after object removal) is just about
unfixable without debugfs overhaul.

> >         * creation of hot_debugfs_root is racy - WTF prevents
> hot_debugfs_root is public for all disk volumes, and is debugfs root
> for hot tracking.
> Why do you think it is racy?
> > two hot_track_init() in parallel?
> I think that mount() will make sure hot_track_init() will be done once
> for the same super block, right? hot_track_init will be done *only*
> when mount is issued.
> That is, mount() can not make sure hot_track_init() is done serially?

What the devil would serialize mount on completely unrelated devices?
And what for?

> >         * what guarantees that sb->s_id is unique?
> sorry, can you let me know where sb->s_id will be not unique?

On any number of filesystem types it isn't; are you making that a restriction
on fs types that can use your stuff?

> >         * removal on failure - screwed; first of all, list_empty()
> On failure, it must be removed? no.

Then what would eventually remove it?  And why bother with lazy creation,
if so?

> >         * hot_debugfs_exit() - screwed in the same way.
> Ditto.

Again, if you don't mind that thing sticking around indefinitely, just
because somebody happened to do ls on it at the moment it would've been
removed otherwise, WTF remove it at all?

> >         * debugfs files get ->i_private set to corresponding sb->s_hot_root.
> > It's copied to seq->private on open() and used by iterators.  WTF prevents
> > open on debugfs, followed by umount of corresponding btrfs volume, freeing of
> > sb->s_hot_root and then read() on our file stepping into kfree'd hot_root
> > in ->start()?
> Good catch, will fix it.

How?

As for the lifetime rules suggestions - depends on what you want to achieve.
How long should those objects live?  In which cases can we get an attempt
of ...unlink... more than once on the same object?

  reply	other threads:[~2013-07-03 13:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 12:17 [PATCH v3 00/13] VFS hot tracking zwu.kernel
2013-06-21 12:17 ` [PATCH v3 01/13] VFS hot tracking: introduce some data structures zwu.kernel
2013-06-21 12:17 ` [PATCH v3 02/13] VFS hot tracking: add i/o freq tracking hooks zwu.kernel
2013-06-21 12:17 ` [PATCH v3 03/13] VFS hot tracking: add one wq to update hot map zwu.kernel
2013-06-21 12:17 ` [PATCH v3 04/13] VFS hot tracking: register one shrinker zwu.kernel
2013-06-21 12:17 ` [PATCH v3 05/13] VFS hot tracking, rcu: introduce one rcu macro for list zwu.kernel
2013-06-21 12:17 ` [PATCH v3 06/13] VFS hot tracking, seq_file: add seq_list rcu interfaces zwu.kernel
2013-06-21 12:17 ` [PATCH v3 07/13] VFS hot tracking: add debugfs support zwu.kernel
2013-06-21 12:17 ` [PATCH v3 08/13] VFS hot tracking: add one ioctl interface zwu.kernel
2013-06-21 12:17 ` [PATCH v3 09/13] VFS hot tracking, procfs: add one proc interface zwu.kernel
2013-06-21 12:17 ` [PATCH v3 10/13] VFS hot tracking: add memory caping function zwu.kernel
2013-06-21 12:17 ` [PATCH v3 11/13] VFS hot tracking, btrfs: add hot tracking support zwu.kernel
2013-06-21 12:17 ` [PATCH v3 12/13] VFS hot tracking: add documentation zwu.kernel
2013-06-21 12:17 ` [PATCH v3 13/13] VFS hot tracking: add fs hot type support zwu.kernel
2013-06-24 13:41 ` [PATCH v3 00/13] VFS hot tracking Zhi Yong Wu
2013-06-28 16:03 ` Al Viro
2013-07-01 13:19   ` Zhi Yong Wu
2013-07-03 13:30     ` Al Viro [this message]
2013-07-03 15:16       ` Zhi Yong Wu
2013-07-08 12:44         ` Zhi Yong Wu
2013-07-02 12:45   ` Zhi Yong Wu

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=20130703133051.GL4165@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=chris.mason@fusionio.com \
    --cc=david@fromorbit.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=sekharan@us.ibm.com \
    --cc=wuzhy@linux.vnet.ibm.com \
    --cc=zwu.kernel@gmail.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.