* Added another debugfs knob for forcing UBIFS R/O mode without flushing caches
or finishing commit or any other I/O operation. I've originally added this knob in order to reproduce the free space fixup bug (seec672793
) on nandsim. Without this knob I would have to do real power-cuts, which would make debugging much harder. Then I've decided to keep this knob because it is also useful for UBIFS power-cut recovery end error-paths testing. * Well-spotted fix from Julia. This bug did not cause real troubles for UBIFS, but nevertheless it could cause issues for someone trying to modify the orphans handling code. Kudos to coccinelle! * Minor cleanups. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJQDQxSAAoJECmIfjd9wqK0W3QQAKCbDBNMJaj/idXcupatoOI2 4M3IBJ5mwfjrBeXy1kcsxxSadW7fJTy6FK7jfPpYq2iCLmFkh0Ba6QSgHHgCmb1v 3ExIR2+2hLl1YhliDU1q+k9H4fGDklq/CNgiTGDti0pdPczZfBKrksXQy8leqT8d MxzQDzQsCxVKIizHHMEr373s1y8QHhabFK1LU1wkXJK/p/bYS0mgD0BOjIrZKuCd W5L5XzIIbcXs1h91Lgdnr8fj5TmMtM1tQ890U2OaNPt+44Eh6Gjjku3N8RaWvaIe vXMpDNb00NwtJp0V2SIsez3VtaA1xJaW7bd4UcyNNvBy5aECNx8K0IbZKTUkiMSj 3xOiqZr/LWpPkAq3NL6kAZkgiam9Aez5Yc+XTna3HP79L/LYbXsJiOewlDwvGbrh 89+EatjLUVFh00BvzmmxuZkm2bWm3sPQiAKWqwc7ijMGwnPt+c6Eiepgw3XXVHgI qmw1Ddkh4VxdGXi8r3RMxg21MqFttM0astT5cmQeF//H6Wq3S2u8RFgZqaLpGc6s vcgx92V6BBrWzCZKxBQs3Bd21uSrVsOa/js5wORpuWZAGk1Yy1BFy1vFC0PuqmcI kvZa/bQPP3/PiHAI8qq2Min5baoG9jUl6ui1eM8KXECkzQSQJjxN1bth8kzZHuPY HMNoK0RVUt3V5xtYI7i7 =ecyI -----END PGP SIGNATURE----- Merge tag 'upstream-3.6-rc1' of git://git.infradead.org/linux-ubifs Pull UBIFS updates from Artem Bityutskiy: - Added another debugfs knob for forcing UBIFS R/O mode without flushing caches or finishing commit or any other I/O operation. I've originally added this knob in order to reproduce the free space fixup bug (see commitc6727932cf
: "UBIFS: fix a bug in empty space fix-up") on nandsim. Without this knob I would have to do real power-cuts, which would make debugging much harder. Then I've decided to keep this knob because it is also useful for UBIFS power-cut recovery end error-paths testing. - Well-spotted fix from Julia. This bug did not cause real troubles for UBIFS, but nevertheless it could cause issues for someone trying to modify the orphans handling code. Kudos to coccinelle! - Minor cleanups. * tag 'upstream-3.6-rc1' of git://git.infradead.org/linux-ubifs: UBIFS: remove invalid reference to list iterator variable UBIFS: simplify reply code a bit UBIFS: add debugfs knob to switch to R/O mode UBIFS: fix compilation warning
This commit is contained in:
commit
93912fe69d
5 changed files with 25 additions and 17 deletions
|
@ -2802,6 +2802,8 @@ static ssize_t dfs_file_read(struct file *file, char __user *u, size_t count,
|
|||
val = d->chk_fs;
|
||||
else if (dent == d->dfs_tst_rcvry)
|
||||
val = d->tst_rcvry;
|
||||
else if (dent == d->dfs_ro_error)
|
||||
val = c->ro_error;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -2885,6 +2887,8 @@ static ssize_t dfs_file_write(struct file *file, const char __user *u,
|
|||
d->chk_fs = val;
|
||||
else if (dent == d->dfs_tst_rcvry)
|
||||
d->tst_rcvry = val;
|
||||
else if (dent == d->dfs_ro_error)
|
||||
c->ro_error = !!val;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -2996,6 +3000,13 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
|
|||
goto out_remove;
|
||||
d->dfs_tst_rcvry = dent;
|
||||
|
||||
fname = "ro_error";
|
||||
dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c,
|
||||
&dfs_fops);
|
||||
if (IS_ERR_OR_NULL(dent))
|
||||
goto out_remove;
|
||||
d->dfs_ro_error = dent;
|
||||
|
||||
return 0;
|
||||
|
||||
out_remove:
|
||||
|
|
|
@ -79,6 +79,10 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c,
|
|||
* @dfs_chk_lprops: debugfs knob to enable UBIFS LEP properties extra checks
|
||||
* @dfs_chk_fs: debugfs knob to enable UBIFS contents extra checks
|
||||
* @dfs_tst_rcvry: debugfs knob to enable UBIFS recovery testing
|
||||
* @dfs_ro_error: debugfs knob to switch UBIFS to R/O mode (different to
|
||||
* re-mounting to R/O mode because it does not flush any buffers
|
||||
* and UBIFS just starts returning -EROFS on all write
|
||||
* operations)
|
||||
*/
|
||||
struct ubifs_debug_info {
|
||||
struct ubifs_zbranch old_zroot;
|
||||
|
@ -122,6 +126,7 @@ struct ubifs_debug_info {
|
|||
struct dentry *dfs_chk_lprops;
|
||||
struct dentry *dfs_chk_fs;
|
||||
struct dentry *dfs_tst_rcvry;
|
||||
struct dentry *dfs_ro_error;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -969,7 +969,7 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
struct ubifs_budget_req ino_req = { .dirtied_ino = 1,
|
||||
.dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
|
||||
struct timespec time;
|
||||
unsigned int saved_nlink;
|
||||
unsigned int uninitialized_var(saved_nlink);
|
||||
|
||||
/*
|
||||
* Budget request settings: deletion direntry, new direntry, removing
|
||||
|
|
|
@ -176,7 +176,7 @@ int ubifs_orphan_start_commit(struct ubifs_info *c)
|
|||
*last = orphan;
|
||||
last = &orphan->cnext;
|
||||
}
|
||||
*last = orphan->cnext;
|
||||
*last = NULL;
|
||||
c->cmt_orphans = c->new_orphans;
|
||||
c->new_orphans = 0;
|
||||
dbg_cmt("%d orphans to commit", c->cmt_orphans);
|
||||
|
@ -382,7 +382,7 @@ static int consolidate(struct ubifs_info *c)
|
|||
last = &orphan->cnext;
|
||||
cnt += 1;
|
||||
}
|
||||
*last = orphan->cnext;
|
||||
*last = NULL;
|
||||
ubifs_assert(cnt == c->tot_orphans - c->new_orphans);
|
||||
c->cmt_orphans = cnt;
|
||||
c->ohead_lnum = c->orph_first;
|
||||
|
|
|
@ -1007,7 +1007,7 @@ static int take_ihead(struct ubifs_info *c)
|
|||
*/
|
||||
int ubifs_replay_journal(struct ubifs_info *c)
|
||||
{
|
||||
int err, i, lnum, offs, free;
|
||||
int err, lnum, free;
|
||||
|
||||
BUILD_BUG_ON(UBIFS_TRUN_KEY > 5);
|
||||
|
||||
|
@ -1025,25 +1025,17 @@ int ubifs_replay_journal(struct ubifs_info *c)
|
|||
dbg_mnt("start replaying the journal");
|
||||
c->replaying = 1;
|
||||
lnum = c->ltail_lnum = c->lhead_lnum;
|
||||
offs = c->lhead_offs;
|
||||
|
||||
for (i = 0; i < c->log_lebs; i++, lnum++) {
|
||||
if (lnum >= UBIFS_LOG_LNUM + c->log_lebs) {
|
||||
/*
|
||||
* The log is logically circular, we reached the last
|
||||
* LEB, switch to the first one.
|
||||
*/
|
||||
lnum = UBIFS_LOG_LNUM;
|
||||
offs = 0;
|
||||
}
|
||||
err = replay_log_leb(c, lnum, offs, c->sbuf);
|
||||
lnum = UBIFS_LOG_LNUM;
|
||||
do {
|
||||
err = replay_log_leb(c, lnum, 0, c->sbuf);
|
||||
if (err == 1)
|
||||
/* We hit the end of the log */
|
||||
break;
|
||||
if (err)
|
||||
goto out;
|
||||
offs = 0;
|
||||
}
|
||||
lnum = ubifs_next_log_lnum(c, lnum);
|
||||
} while (lnum != UBIFS_LOG_LNUM);
|
||||
|
||||
err = replay_buds(c);
|
||||
if (err)
|
||||
|
|
Loading…
Reference in a new issue