diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-19 17:49:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-19 17:49:16 -0500 |
commit | e19c29e8d8d3b2dbc4c9a859f40c3f95ed089441 (patch) | |
tree | 9fb1d7c2973bbcae7632d4380868ef8c9ce40713 | |
parent | afd290945cd283030b51b433a66fe57a8feb28c8 (diff) | |
parent | 8bc5191b261c4fd9a5e9052cebe04ce2ef05f2e7 (diff) |
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
-rw-r--r-- | fs/inode.c | 3 | ||||
-rw-r--r-- | fs/qnx4/inode.c | 62 | ||||
-rw-r--r-- | fs/super.c | 2 |
3 files changed, 27 insertions, 40 deletions
diff --git a/fs/inode.c b/fs/inode.c index 4fa4f0916af9..fb10d86ffad7 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -322,9 +322,6 @@ EXPORT_SYMBOL(clear_nlink); | |||
322 | void set_nlink(struct inode *inode, unsigned int nlink) | 322 | void set_nlink(struct inode *inode, unsigned int nlink) |
323 | { | 323 | { |
324 | if (!nlink) { | 324 | if (!nlink) { |
325 | printk_ratelimited(KERN_INFO | ||
326 | "set_nlink() clearing i_nlink on %s inode %li\n", | ||
327 | inode->i_sb->s_type->name, inode->i_ino); | ||
328 | clear_nlink(inode); | 325 | clear_nlink(inode); |
329 | } else { | 326 | } else { |
330 | /* Yes, some filesystems do change nlink from zero to one */ | 327 | /* Yes, some filesystems do change nlink from zero to one */ |
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 2bfd987f4853..6b009548d2e0 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c | |||
@@ -179,47 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb) | |||
179 | struct qnx4_inode_entry *rootdir; | 179 | struct qnx4_inode_entry *rootdir; |
180 | int rd, rl; | 180 | int rd, rl; |
181 | int i, j; | 181 | int i, j; |
182 | int found = 0; | ||
183 | 182 | ||
184 | if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') { | 183 | if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') |
185 | return "no qnx4 filesystem (no root dir)."; | 184 | return "no qnx4 filesystem (no root dir)."; |
186 | } else { | 185 | QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id)); |
187 | QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id)); | 186 | rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; |
188 | rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; | 187 | rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); |
189 | rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); | 188 | for (j = 0; j < rl; j++) { |
190 | for (j = 0; j < rl; j++) { | 189 | bh = sb_bread(sb, rd + j); /* root dir, first block */ |
191 | bh = sb_bread(sb, rd + j); /* root dir, first block */ | 190 | if (bh == NULL) |
192 | if (bh == NULL) { | 191 | return "unable to read root entry."; |
193 | return "unable to read root entry."; | 192 | rootdir = (struct qnx4_inode_entry *) bh->b_data; |
194 | } | 193 | for (i = 0; i < QNX4_INODES_PER_BLOCK; i++, rootdir++) { |
195 | for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) { | 194 | QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); |
196 | rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE); | 195 | if (strcmp(rootdir->di_fname, QNX4_BMNAME) != 0) |
197 | if (rootdir->di_fname != NULL) { | 196 | continue; |
198 | QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); | 197 | qnx4_sb(sb)->BitMap = kmemdup(rootdir, |
199 | if (!strcmp(rootdir->di_fname, | 198 | sizeof(struct qnx4_inode_entry), |
200 | QNX4_BMNAME)) { | 199 | GFP_KERNEL); |
201 | found = 1; | ||
202 | qnx4_sb(sb)->BitMap = kmemdup(rootdir, | ||
203 | sizeof(struct qnx4_inode_entry), | ||
204 | GFP_KERNEL); | ||
205 | if (!qnx4_sb(sb)->BitMap) { | ||
206 | brelse (bh); | ||
207 | return "not enough memory for bitmap inode"; | ||
208 | }/* keep bitmap inode known */ | ||
209 | break; | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | brelse(bh); | 200 | brelse(bh); |
214 | if (found != 0) { | 201 | if (!qnx4_sb(sb)->BitMap) |
215 | break; | 202 | return "not enough memory for bitmap inode"; |
216 | } | 203 | /* keep bitmap inode known */ |
217 | } | 204 | return NULL; |
218 | if (found == 0) { | ||
219 | return "bitmap file not found."; | ||
220 | } | 205 | } |
206 | brelse(bh); | ||
221 | } | 207 | } |
222 | return NULL; | 208 | return "bitmap file not found."; |
223 | } | 209 | } |
224 | 210 | ||
225 | static int qnx4_fill_super(struct super_block *s, void *data, int silent) | 211 | 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 | if (IS_ERR(root)) { | 256 | if (IS_ERR(root)) { |
271 | printk(KERN_ERR "qnx4: get inode failed\n"); | 257 | printk(KERN_ERR "qnx4: get inode failed\n"); |
272 | ret = PTR_ERR(root); | 258 | ret = PTR_ERR(root); |
273 | goto out; | 259 | goto outb; |
274 | } | 260 | } |
275 | 261 | ||
276 | ret = -ENOMEM; | 262 | ret = -ENOMEM; |
@@ -283,6 +269,8 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) | |||
283 | 269 | ||
284 | outi: | 270 | outi: |
285 | iput(root); | 271 | iput(root); |
272 | outb: | ||
273 | kfree(qs->BitMap); | ||
286 | out: | 274 | out: |
287 | brelse(bh); | 275 | brelse(bh); |
288 | outnobh: | 276 | outnobh: |
diff --git a/fs/super.c b/fs/super.c index de41e1e46f09..6015c02296b7 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -1186,6 +1186,8 @@ int freeze_super(struct super_block *sb) | |||
1186 | printk(KERN_ERR | 1186 | printk(KERN_ERR |
1187 | "VFS:Filesystem freeze failed\n"); | 1187 | "VFS:Filesystem freeze failed\n"); |
1188 | sb->s_frozen = SB_UNFROZEN; | 1188 | sb->s_frozen = SB_UNFROZEN; |
1189 | smp_wmb(); | ||
1190 | wake_up(&sb->s_wait_unfrozen); | ||
1189 | deactivate_locked_super(sb); | 1191 | deactivate_locked_super(sb); |
1190 | return ret; | 1192 | return ret; |
1191 | } | 1193 | } |