LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Mateusz Guzik <mguzik@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>, Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	swhiteho@redhat.com, cluster-devel@redhat.com
Subject: Re: [PATCH v3] fs: record task name which froze superblock
Date: Mon, 9 Mar 2015 18:14:00 +0300	[thread overview]
Message-ID: <CACVxJT-zN3mvFNYPPW8S3XB8U3jabznBbHjGE3RP4D11xNXp9w@mail.gmail.com> (raw)
In-Reply-To: <20150302044633.GB2516@mguzik>

On Mon, Mar 2, 2015 at 7:46 AM, Mateusz Guzik <mguzik@redhat.com> wrote:
> On Mon, Mar 02, 2015 at 05:38:29AM +0100, Mateusz Guzik wrote:
>> On Sun, Mar 01, 2015 at 08:31:26AM +1100, Dave Chinner wrote:
>> > On Sat, Feb 28, 2015 at 05:25:57PM +0300, Alexey Dobriyan wrote:
>> > > Freezing and thawing are separate system calls, task which is supposed
>> > > to thaw filesystem/superblock can disappear due to crash or not thaw
>> > > due to a bug. At least record task name (we can't take task_struct
>> > > reference) to make support engineer's life easier.
>> > >
>> > > Hopefully 16 bytes per superblock isn't much.
>> > >
>> > > TASK_COMM_LEN definition (which is userspace ABI, see prctl(PR_SET_NAME)) is
>> > > moved to userspace exported header to not drag sched.h into every fs.h inclusion.
>> > >
>> > > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>> >
>> > Freeze/thaw can be nested at the block level. That means the
>> > sb->s_writers.freeze_comm can point at the wrong process. i.e.
>> >
>> > Task A                      Task B
>> > freeze_bdev
>> >   freeze_super
>> >     freeze_comm = A
>> >                     freeze_bdev
>> > .....
>> > thaw_bdev
>> >  <device still frozen>
>> >                     <crash>
>> >
>> > At this point, the block device will never be unthawed, but
>> > the debug field is now pointing to the wrong task. i.e. The debug
>> > helper has not recorded the process that is actually causing the
>> > problem, and leads us all off on a wild goose chase down the wrong
>> > path.
>> >
>> > IMO, debug code is only useful if it's reliable.....
>> >
>>
>> It can be trivially modified to be very useful to support people.
>>
>> Actually this patch clears saved task name on unfreeze, so in this
>> particular scenario we would end up with no data.
>>
>> Freezer and unfreezer names don't even have to match, so there is not
>> much we can do here (e.g. recording all names in a linked list or
>> something is a non-starter because of this).
>>
>> I propose the following:
>> - on freezing:
>> 1. if 0->1 save the name
>> 2. if 1->2 have a flag to note there is an additional freezer
>> - on unfreezing
>> 1. if 1->0 clear the flag
>> 2. DO NOT clear the name in any case
>>
>
> Now that I sent this e-mail I realized we could actually keep a linked
> list of freezer names. Unfreezing would delete all elements when going
> 1->0, but would not touch it otherwise.

If you do linked list two processes constantly keeping superblock frozen
will allocate all the memory:

F
  F
  T
  F
  T
 ...

After all valid objections and comments I think the way to proceed is
a) record freeze_comm, never clear it (maybe record thaw_comm)
b) record "i am not the only one" flag
c) introduce debug_freeze which will "record" everything in dmesg
for situations when crashdump is not used but serial console is.

    Alexey

  reply	other threads:[~2015-03-09 15:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-14 18:55 [PATCH] " Alexey Dobriyan
2015-02-16  9:38 ` Jan Kara
2015-02-18  7:34   ` Alexey Dobriyan
2015-02-18  7:36     ` [PATCH v2] " Alexey Dobriyan
2015-02-18  9:13     ` [PATCH] " Jan Kara
2015-02-18 10:18       ` Steven Whitehouse
2015-02-20 11:42       ` Alexey Dobriyan
2015-02-20 12:15         ` Jan Kara
2015-02-28 14:22           ` Alexey Dobriyan
2015-02-28 14:25             ` [PATCH v3] " Alexey Dobriyan
2015-02-28 21:31               ` Dave Chinner
2015-03-02  4:38                 ` Mateusz Guzik
2015-03-02  4:46                   ` Mateusz Guzik
2015-03-09 15:14                     ` Alexey Dobriyan [this message]
2015-03-02 21:33                   ` Dave Chinner
2015-03-04 15:14                   ` Alexey Dobriyan

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=CACVxJT-zN3mvFNYPPW8S3XB8U3jabznBbHjGE3RP4D11xNXp9w@mail.gmail.com \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cluster-devel@redhat.com \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mguzik@redhat.com \
    --cc=swhiteho@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH v3] fs: record task name which froze superblock' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).