Re: [PATCH] deadlock with suspend and quotas

From: Jan Kara
Date: Tue Nov 29 2011 - 06:11:39 EST


On Tue 29-11-11 06:06:21, Mikulas Patocka wrote:
> On Tue 29-11-11 11:19:01, Jan Kara wrote:
> > Hi,
> >
> > On Mon 28-11-11 18:32:18, Mikulas Patocka wrote:
> > > > Hi
> > > >
> > > > Where can I get that patch set?
> > > >
> > > > We are experiencing other similar deadlocks on RHEL-6, caused by sync or
> > > > background writeback (these code paths take s_umount and wait trying to do
> > > > I/O), but I wasn't able to reproduce these deadlocks on upstream kernel?
> > > > Are there other known deadlock possibilities?
> > >
> > > I found some patch named "[RFC PATCH 1/3] VFS: Fix s_umount thaw/write
> > > deadlock" (I couldn't find the next two parts of the patch in the
> > > archives). And the patch looks wrong:
> > Yes, that seems to be the series. I generally agree with you that the
> > last iteration still had some problems and some changes were requested.
> > That's why it's not merged yet after all...
> >
> > > - down_read_trylock(&sb->s_umount) doesn't fix anything. The lock is not
> > > held when the filesystem is frozen and it is taken for write when thawing.
> > > Consequently, any task can succeed with down_read_trylock(&sb->s_umount)
> > > on a frozen filesystem and if this tasks attempts to do an I/O that is
> > > waiting for thaw, it may still deadlock.
> > Agreed.
> >
> > > - skipping sync on frozen filesystem violates sync semantics.
> > > Applications, such as databases, assume that when sync finishes, data were
> > > written to stable storage. If we skip sync when the filesystem is frozen,
> > > we can cause data corruption in these applications (if the system crashes
> > > after we skipped a sync).
> > Here I don't agree. Filesystem must guarantee there are no dirty data on
> > a frozen filesystem.
>
> This is technically impossible to achieve on ext2, fat or other
> non-transactional filesystems. These filesystems have no locks around code
> paths that set data or inodes dirty. And you still need working sync for
> ext2. So the best thing to do in sync is to wait until the filesystem is
> unfrozen.
Then suspend is effectively unsupported on the filesystem and should
return EOPNOTSUPP? At least that's what I'd expect...

Honza
--
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
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/