提交 e19c29e8 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  qnx4: don't leak ->BitMap on late failure exits
  qnx4: reduce the insane nesting in qnx4_checkroot()
  qnx4: di_fname is an array, for crying out loud...
  vfs: remove printk from set_nlink()
  wake up s_wait_unfrozen when ->freeze_fs fails
...@@ -322,9 +322,6 @@ EXPORT_SYMBOL(clear_nlink); ...@@ -322,9 +322,6 @@ EXPORT_SYMBOL(clear_nlink);
void set_nlink(struct inode *inode, unsigned int nlink) void set_nlink(struct inode *inode, unsigned int nlink)
{ {
if (!nlink) { if (!nlink) {
printk_ratelimited(KERN_INFO
"set_nlink() clearing i_nlink on %s inode %li\n",
inode->i_sb->s_type->name, inode->i_ino);
clear_nlink(inode); clear_nlink(inode);
} else { } else {
/* Yes, some filesystems do change nlink from zero to one */ /* Yes, some filesystems do change nlink from zero to one */
......
...@@ -179,47 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb) ...@@ -179,47 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb)
struct qnx4_inode_entry *rootdir; struct qnx4_inode_entry *rootdir;
int rd, rl; int rd, rl;
int i, j; int i, j;
int found = 0;
if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') { if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/')
return "no qnx4 filesystem (no root dir)."; return "no qnx4 filesystem (no root dir).";
} else { QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id));
QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id)); rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); for (j = 0; j < rl; j++) {
for (j = 0; j < rl; j++) { bh = sb_bread(sb, rd + j); /* root dir, first block */
bh = sb_bread(sb, rd + j); /* root dir, first block */ if (bh == NULL)
if (bh == NULL) { return "unable to read root entry.";
return "unable to read root entry."; rootdir = (struct qnx4_inode_entry *) bh->b_data;
} for (i = 0; i < QNX4_INODES_PER_BLOCK; i++, rootdir++) {
for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) { QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname));
rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE); if (strcmp(rootdir->di_fname, QNX4_BMNAME) != 0)
if (rootdir->di_fname != NULL) { continue;
QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); qnx4_sb(sb)->BitMap = kmemdup(rootdir,
if (!strcmp(rootdir->di_fname, sizeof(struct qnx4_inode_entry),
QNX4_BMNAME)) { GFP_KERNEL);
found = 1;
qnx4_sb(sb)->BitMap = kmemdup(rootdir,
sizeof(struct qnx4_inode_entry),
GFP_KERNEL);
if (!qnx4_sb(sb)->BitMap) {
brelse (bh);
return "not enough memory for bitmap inode";
}/* keep bitmap inode known */
break;
}
}
}
brelse(bh); brelse(bh);
if (found != 0) { if (!qnx4_sb(sb)->BitMap)
break; return "not enough memory for bitmap inode";
} /* keep bitmap inode known */
} return NULL;
if (found == 0) {
return "bitmap file not found.";
} }
brelse(bh);
} }
return NULL; return "bitmap file not found.";
} }
static int qnx4_fill_super(struct super_block *s, void *data, int silent) static int qnx4_fill_super(struct super_block *s, void *data, int silent)
...@@ -270,7 +256,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) ...@@ -270,7 +256,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
if (IS_ERR(root)) { if (IS_ERR(root)) {
printk(KERN_ERR "qnx4: get inode failed\n"); printk(KERN_ERR "qnx4: get inode failed\n");
ret = PTR_ERR(root); ret = PTR_ERR(root);
goto out; goto outb;
} }
ret = -ENOMEM; ret = -ENOMEM;
...@@ -283,6 +269,8 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) ...@@ -283,6 +269,8 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
outi: outi:
iput(root); iput(root);
outb:
kfree(qs->BitMap);
out: out:
brelse(bh); brelse(bh);
outnobh: outnobh:
......
...@@ -1186,6 +1186,8 @@ int freeze_super(struct super_block *sb) ...@@ -1186,6 +1186,8 @@ int freeze_super(struct super_block *sb)
printk(KERN_ERR printk(KERN_ERR
"VFS:Filesystem freeze failed\n"); "VFS:Filesystem freeze failed\n");
sb->s_frozen = SB_UNFROZEN; sb->s_frozen = SB_UNFROZEN;
smp_wmb();
wake_up(&sb->s_wait_unfrozen);
deactivate_locked_super(sb); deactivate_locked_super(sb);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册