Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1338523

Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned during cgroup writeback association switches

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned during cgroup writeback association switches
Date 2016-02-19 23:20 +0100
Message-ID <r41z3-3I8-9@gated-at.bofh.it> (permalink)
References (5 earlier) <r3txo-3CY-21@gated-at.bofh.it> <r3wvh-5Xo-17@gated-at.bofh.it> <r3ZGV-2hA-11@gated-at.bofh.it> <r40jE-2yF-1@gated-at.bofh.it> <r41fJ-3j1-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

On Fri, Feb 19, 2016 at 09:58:11PM +0000, Al Viro wrote:
> Um...  What ordering requirements do you have?  You obviously shouldn't
> let it continue past the shutdown - as the matter of fact, you *can't* let
> it continue past generic_shutdown_super(), since any inode references
> held at evict_inodes() time will make it very unhappy.  Attempts to do
> any IO after that will make things a lot worse than unhappy - data structures
> needed to do it might be gone (and if you hold a bit longer, filesystem
> driver itself might very well be gone, along with the functions you were
> going to call).

It can be thought of as an extension of fs writeback operation and
it'd be ideal if it can hold off sb shutdown as on-going writeback
does through holding s_umount.  Unfortunately, that doesn't seem
possible because there's no way to transfer rwsem ownership.

It doesn't generate any IO.  The reason it's done asynchronously is
because the operation requires an RCU grace period.  After the grace
period, it accesses only the generic inode and address_space and the
only time it ends up accessing sb is through the iput call.
Everything else AFAICS doesn't really care whether the underlying sb
is shut down or not.

> Grabbing ->s_active is a seriously bad idea for another reason - in
> a situation when there's only one mount of given fs, plain umount() should
> _not_ return 0 before fs shutdown is over.  Sure, it is possible that there's
> a binding somewhere, or that it's a lazy umount, etc., but those are "you've
> asked for it" situations; having plain umount of e.g. ext3 on a USB stick
> return success before it is safe to pull that stick out is a Bloody Bad Idea,
> for obvious usability reasons.

I see.

> IOW, while fs shutdown may be async, making it *always* async would be a bad
> bug.  And bumping ->s_active does just that.
> 
> I'd go for trylock inside that work + making generic_shutdown_super()
> kill all such works.  I assume that it *can* be abandoned in situation
> when we know that sync_filesystem() is about to be called and that
> said sync_filesystem() won't, in turn, schedule any such works, of course...

I'll make generic_shutdown_super() to kill all such work items.  I
don't think the work item itself would need further locking tho.  Can
you please elaborate why you thought adding trylock to the work would
be necessary?

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH block/for-4.5-fixes] writeback: keep superblock pinned during  cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-16 19:30 +0100
  Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Jens Axboe <axboe@kernel.dk> - 2016-02-16 19:40 +0100
  Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Jan Kara <jack@suse.cz> - 2016-02-17 22:00 +0100
    Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-17 22:10 +0100
      Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Jan Kara <jack@suse.cz> - 2016-02-17 23:30 +0100
        Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tahsin Erdogan <tahsin@google.com> - 2016-02-17 23:50 +0100
          Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-18 00:10 +0100
            Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Jan Kara <jack@suse.cz> - 2016-02-18 11:00 +0100
              Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-18 14:10 +0100
                Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Jan Kara <jack@suse.cz> - 2016-02-18 14:30 +0100
                Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Al Viro <viro@ZenIV.linux.org.uk> - 2016-02-19 21:20 +0100
                Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-19 22:00 +0100
                Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Al Viro <viro@ZenIV.linux.org.uk> - 2016-02-19 23:00 +0100
                Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-19 23:20 +0100
                Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Al Viro <viro@ZenIV.linux.org.uk> - 2016-02-19 23:30 +0100
  Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Nikolay Borisov <kernel@kyup.com> - 2016-02-18 11:20 +0100
    Re: [PATCH block/for-4.5-fixes] writeback: keep superblock pinned  during cgroup writeback association switches Tejun Heo <tj@kernel.org> - 2016-02-18 14:00 +0100

csiph-web