Skip to content

Commit

Permalink
UBIFS: allow for sync_fs when read-only
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Hunter authored and Artem Bityutskiy committed Sep 30, 2008
1 parent 403e12a commit bed7993
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,21 +420,22 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
int i, ret = 0, err;
long long bud_bytes;

if (c->jheads)
if (c->jheads) {
for (i = 0; i < c->jhead_cnt; i++) {
err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
if (err && !ret)
ret = err;
}

/* Commit the journal unless it has too few data */
spin_lock(&c->buds_lock);
bud_bytes = c->bud_bytes;
spin_unlock(&c->buds_lock);
if (bud_bytes > c->leb_size) {
err = ubifs_run_commit(c);
if (err)
return err;
/* Commit the journal unless it has too little data */
spin_lock(&c->buds_lock);
bud_bytes = c->bud_bytes;
spin_unlock(&c->buds_lock);
if (bud_bytes > c->leb_size) {
err = ubifs_run_commit(c);
if (err)
return err;
}
}

/*
Expand Down

0 comments on commit bed7993

Please sign in to comment.