lkml.org 
[lkml]   [2010]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: fix filesystem_sync vs write race on rw=>ro remount
On Mon, Jan 25, 2010 at 12:15:51AM +0300, Dmitry Monakhov wrote:

> > It's not a solution. You get an _attempted_ remount ro making writes
> > fail, even if it's going to be unsuccessful. No go...
> We have two options for new writers:
> 1) Fail it via -EROFS
> Yes, remount may fail, but it is really unlikely.
> 2) Defer(block) new writers on until we complete or fail remount
> for example like follows. Do you like second solution ?

Umm... I wonder what the locking implications would be... Frankly,
I suspect that what we really want is this:
* per-superblock write count of some kind, bumped when we decide
that writeback is inevitable and dropped when we are done with it (the
same thing goes for async part of unlink(), etc.)
* fs_may_remount_ro() checking that write count
So basically we try to push those short-term writers to completion and
if new ones had come while we'd been doing that (or some are really
stuck) we fail remount with -EBUSY.

As a short-term solution the second patch would do probably (-stable and .33),
but in the next cycle I'd rather see something addressing the real problem.
fs_may_remount_ro() in its current form is really broken by design - it
should not scan any lists (which is where your race comes from, BTW)



\
 
 \ /
  Last update: 2010-01-24 22:39    [W:0.057 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site