Re: [PATCH v3] fs: record task name which froze superblock

From: Dave Chinner
Date: Mon Mar 02 2015 - 16:34:20 EST


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@xxxxxxxxx>
> >
> > 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.

It only clears it i thaw_super(), which is *not called* until the
last nested thaw_bdev() call is made.

When the system is hung what we actually need to know is who is
responsible for *thawing* the filesystem and then we can work out
why that hasn't run. What this code tries to do is identify who
froze the filesystem and so indicate who *might* be responsible for
thawing it. If we mis-identify the agent who holds the freeze
status, then we fail to identify who needs to run the thaw and hence
we're still stuck not knowing WTF happened....

I understand why you want to record this - I'm not arguing that we
shouldn't do this. My point is that we should *make it reliable* and
not in any way ambiguous, otherwise we failed to solve the problem
it was intended for.

Cheers,

Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/