diff options
author | Adrian Hunter <ext-adrian.hunter@nokia.com> | 2008-09-11 07:25:44 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-09-30 04:12:58 -0400 |
commit | bed79935de9a658678f44b88a097367d3b26429f (patch) | |
tree | 34f34c585f12d99dbb55131bc389a4894242d102 /fs/ubifs | |
parent | 403e12ab30ab160e1015bd998f0abc1865c574e0 (diff) |
UBIFS: allow for sync_fs when read-only
sync_fs can be called even if the file system is mounted
read-only. Ensure the commit is not run in that case.
Reported-by: Zoltan Sogor <weth@inf.u-szeged.hu>
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/super.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 7e1f3efdf632..7fd759dde796 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -420,21 +420,22 @@ static int ubifs_sync_fs(struct super_block *sb, int wait) | |||
420 | int i, ret = 0, err; | 420 | int i, ret = 0, err; |
421 | long long bud_bytes; | 421 | long long bud_bytes; |
422 | 422 | ||
423 | if (c->jheads) | 423 | if (c->jheads) { |
424 | for (i = 0; i < c->jhead_cnt; i++) { | 424 | for (i = 0; i < c->jhead_cnt; i++) { |
425 | err = ubifs_wbuf_sync(&c->jheads[i].wbuf); | 425 | err = ubifs_wbuf_sync(&c->jheads[i].wbuf); |
426 | if (err && !ret) | 426 | if (err && !ret) |
427 | ret = err; | 427 | ret = err; |
428 | } | 428 | } |
429 | 429 | ||
430 | /* Commit the journal unless it has too few data */ | 430 | /* Commit the journal unless it has too little data */ |
431 | spin_lock(&c->buds_lock); | 431 | spin_lock(&c->buds_lock); |
432 | bud_bytes = c->bud_bytes; | 432 | bud_bytes = c->bud_bytes; |
433 | spin_unlock(&c->buds_lock); | 433 | spin_unlock(&c->buds_lock); |
434 | if (bud_bytes > c->leb_size) { | 434 | if (bud_bytes > c->leb_size) { |
435 | err = ubifs_run_commit(c); | 435 | err = ubifs_run_commit(c); |
436 | if (err) | 436 | if (err) |
437 | return err; | 437 | return err; |
438 | } | ||
438 | } | 439 | } |
439 | 440 | ||
440 | /* | 441 | /* |