aboutsummaryrefslogtreecommitdiffstats
path: root/fs/minix
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 16:36:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 16:36:41 -0400
commite2a0883e4071237d09b604a342c28b96b44a04b3 (patch)
treeaa56f4d376b5eb1c32358c19c2669c2a94e0e1fd /fs/minix
parent3a990a52f9f25f45469e272017a31e7a3fda60ed (diff)
parent07c0c5d8b8c122b2f2df9ee574ac3083daefc981 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile 1 from Al Viro: "This is _not_ all; in particular, Miklos' and Jan's stuff is not there yet." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (64 commits) ext4: initialization of ext4_li_mtx needs to be done earlier debugfs-related mode_t whack-a-mole hfsplus: add an ioctl to bless files hfsplus: change finder_info to u32 hfsplus: initialise userflags qnx4: new helper - try_extent() qnx4: get rid of qnx4_bread/qnx4_getblk take removal of PF_FORKNOEXEC to flush_old_exec() trim includes in inode.c um: uml_dup_mmap() relies on ->mmap_sem being held, but activate_mm() doesn't hold it um: embed ->stub_pages[] into mmu_context gadgetfs: list_for_each_safe() misuse ocfs2: fix leaks on failure exits in module_init ecryptfs: make register_filesystem() the last potential failure exit ntfs: forgets to unregister sysctls on register_filesystem() failure logfs: missing cleanup on register_filesystem() failure jfs: mising cleanup on register_filesystem() failure make configfs_pin_fs() return root dentry on success configfs: configfs_create_dir() has parent dentry in dentry->d_parent configfs: sanitize configfs_create() ...
Diffstat (limited to 'fs/minix')
-rw-r--r--fs/minix/inode.c38
-rw-r--r--fs/minix/minix.h1
-rw-r--r--fs/minix/namei.c14
3 files changed, 18 insertions, 35 deletions
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index fa8b612b8ce2..fcb05d2c6b5f 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -190,24 +190,24 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
190 sbi->s_version = MINIX_V1; 190 sbi->s_version = MINIX_V1;
191 sbi->s_dirsize = 16; 191 sbi->s_dirsize = 16;
192 sbi->s_namelen = 14; 192 sbi->s_namelen = 14;
193 sbi->s_link_max = MINIX_LINK_MAX; 193 s->s_max_links = MINIX_LINK_MAX;
194 } else if (s->s_magic == MINIX_SUPER_MAGIC2) { 194 } else if (s->s_magic == MINIX_SUPER_MAGIC2) {
195 sbi->s_version = MINIX_V1; 195 sbi->s_version = MINIX_V1;
196 sbi->s_dirsize = 32; 196 sbi->s_dirsize = 32;
197 sbi->s_namelen = 30; 197 sbi->s_namelen = 30;
198 sbi->s_link_max = MINIX_LINK_MAX; 198 s->s_max_links = MINIX_LINK_MAX;
199 } else if (s->s_magic == MINIX2_SUPER_MAGIC) { 199 } else if (s->s_magic == MINIX2_SUPER_MAGIC) {
200 sbi->s_version = MINIX_V2; 200 sbi->s_version = MINIX_V2;
201 sbi->s_nzones = ms->s_zones; 201 sbi->s_nzones = ms->s_zones;
202 sbi->s_dirsize = 16; 202 sbi->s_dirsize = 16;
203 sbi->s_namelen = 14; 203 sbi->s_namelen = 14;
204 sbi->s_link_max = MINIX2_LINK_MAX; 204 s->s_max_links = MINIX2_LINK_MAX;
205 } else if (s->s_magic == MINIX2_SUPER_MAGIC2) { 205 } else if (s->s_magic == MINIX2_SUPER_MAGIC2) {
206 sbi->s_version = MINIX_V2; 206 sbi->s_version = MINIX_V2;
207 sbi->s_nzones = ms->s_zones; 207 sbi->s_nzones = ms->s_zones;
208 sbi->s_dirsize = 32; 208 sbi->s_dirsize = 32;
209 sbi->s_namelen = 30; 209 sbi->s_namelen = 30;
210 sbi->s_link_max = MINIX2_LINK_MAX; 210 s->s_max_links = MINIX2_LINK_MAX;
211 } else if ( *(__u16 *)(bh->b_data + 24) == MINIX3_SUPER_MAGIC) { 211 } else if ( *(__u16 *)(bh->b_data + 24) == MINIX3_SUPER_MAGIC) {
212 m3s = (struct minix3_super_block *) bh->b_data; 212 m3s = (struct minix3_super_block *) bh->b_data;
213 s->s_magic = m3s->s_magic; 213 s->s_magic = m3s->s_magic;
@@ -221,9 +221,9 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
221 sbi->s_dirsize = 64; 221 sbi->s_dirsize = 64;
222 sbi->s_namelen = 60; 222 sbi->s_namelen = 60;
223 sbi->s_version = MINIX_V3; 223 sbi->s_version = MINIX_V3;
224 sbi->s_link_max = MINIX2_LINK_MAX;
225 sbi->s_mount_state = MINIX_VALID_FS; 224 sbi->s_mount_state = MINIX_VALID_FS;
226 sb_set_blocksize(s, m3s->s_blocksize); 225 sb_set_blocksize(s, m3s->s_blocksize);
226 s->s_max_links = MINIX2_LINK_MAX;
227 } else 227 } else
228 goto out_no_fs; 228 goto out_no_fs;
229 229
@@ -254,14 +254,6 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
254 minix_set_bit(0,sbi->s_imap[0]->b_data); 254 minix_set_bit(0,sbi->s_imap[0]->b_data);
255 minix_set_bit(0,sbi->s_zmap[0]->b_data); 255 minix_set_bit(0,sbi->s_zmap[0]->b_data);
256 256
257 /* set up enough so that it can read an inode */
258 s->s_op = &minix_sops;
259 root_inode = minix_iget(s, MINIX_ROOT_INO);
260 if (IS_ERR(root_inode)) {
261 ret = PTR_ERR(root_inode);
262 goto out_no_root;
263 }
264
265 /* Apparently minix can create filesystems that allocate more blocks for 257 /* Apparently minix can create filesystems that allocate more blocks for
266 * the bitmaps than needed. We simply ignore that, but verify it didn't 258 * the bitmaps than needed. We simply ignore that, but verify it didn't
267 * create one with not enough blocks and bail out if so. 259 * create one with not enough blocks and bail out if so.
@@ -270,7 +262,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
270 if (sbi->s_imap_blocks < block) { 262 if (sbi->s_imap_blocks < block) {
271 printk("MINIX-fs: file system does not have enough " 263 printk("MINIX-fs: file system does not have enough "
272 "imap blocks allocated. Refusing to mount\n"); 264 "imap blocks allocated. Refusing to mount\n");
273 goto out_iput; 265 goto out_no_bitmap;
274 } 266 }
275 267
276 block = minix_blocks_needed( 268 block = minix_blocks_needed(
@@ -279,13 +271,21 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
279 if (sbi->s_zmap_blocks < block) { 271 if (sbi->s_zmap_blocks < block) {
280 printk("MINIX-fs: file system does not have enough " 272 printk("MINIX-fs: file system does not have enough "
281 "zmap blocks allocated. Refusing to mount.\n"); 273 "zmap blocks allocated. Refusing to mount.\n");
282 goto out_iput; 274 goto out_no_bitmap;
275 }
276
277 /* set up enough so that it can read an inode */
278 s->s_op = &minix_sops;
279 root_inode = minix_iget(s, MINIX_ROOT_INO);
280 if (IS_ERR(root_inode)) {
281 ret = PTR_ERR(root_inode);
282 goto out_no_root;
283 } 283 }
284 284
285 ret = -ENOMEM; 285 ret = -ENOMEM;
286 s->s_root = d_alloc_root(root_inode); 286 s->s_root = d_make_root(root_inode);
287 if (!s->s_root) 287 if (!s->s_root)
288 goto out_iput; 288 goto out_no_root;
289 289
290 if (!(s->s_flags & MS_RDONLY)) { 290 if (!(s->s_flags & MS_RDONLY)) {
291 if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ 291 if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */
@@ -301,10 +301,6 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
301 301
302 return 0; 302 return 0;
303 303
304out_iput:
305 iput(root_inode);
306 goto out_freemap;
307
308out_no_root: 304out_no_root:
309 if (!silent) 305 if (!silent)
310 printk("MINIX-fs: get root inode failed\n"); 306 printk("MINIX-fs: get root inode failed\n");
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index c889ef0aa571..1ebd11854622 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -34,7 +34,6 @@ struct minix_sb_info {
34 unsigned long s_max_size; 34 unsigned long s_max_size;
35 int s_dirsize; 35 int s_dirsize;
36 int s_namelen; 36 int s_namelen;
37 int s_link_max;
38 struct buffer_head ** s_imap; 37 struct buffer_head ** s_imap;
39 struct buffer_head ** s_zmap; 38 struct buffer_head ** s_zmap;
40 struct buffer_head * s_sbh; 39 struct buffer_head * s_sbh;
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 2f76e38c2065..2d0ee1786305 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -94,9 +94,6 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
94{ 94{
95 struct inode *inode = old_dentry->d_inode; 95 struct inode *inode = old_dentry->d_inode;
96 96
97 if (inode->i_nlink >= minix_sb(inode->i_sb)->s_link_max)
98 return -EMLINK;
99
100 inode->i_ctime = CURRENT_TIME_SEC; 97 inode->i_ctime = CURRENT_TIME_SEC;
101 inode_inc_link_count(inode); 98 inode_inc_link_count(inode);
102 ihold(inode); 99 ihold(inode);
@@ -106,10 +103,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
106static int minix_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode) 103static int minix_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode)
107{ 104{
108 struct inode * inode; 105 struct inode * inode;
109 int err = -EMLINK; 106 int err;
110
111 if (dir->i_nlink >= minix_sb(dir->i_sb)->s_link_max)
112 goto out;
113 107
114 inode_inc_link_count(dir); 108 inode_inc_link_count(dir);
115 109
@@ -181,7 +175,6 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)
181static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, 175static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
182 struct inode * new_dir, struct dentry *new_dentry) 176 struct inode * new_dir, struct dentry *new_dentry)
183{ 177{
184 struct minix_sb_info * info = minix_sb(old_dir->i_sb);
185 struct inode * old_inode = old_dentry->d_inode; 178 struct inode * old_inode = old_dentry->d_inode;
186 struct inode * new_inode = new_dentry->d_inode; 179 struct inode * new_inode = new_dentry->d_inode;
187 struct page * dir_page = NULL; 180 struct page * dir_page = NULL;
@@ -219,11 +212,6 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
219 drop_nlink(new_inode); 212 drop_nlink(new_inode);
220 inode_dec_link_count(new_inode); 213 inode_dec_link_count(new_inode);
221 } else { 214 } else {
222 if (dir_de) {
223 err = -EMLINK;
224 if (new_dir->i_nlink >= info->s_link_max)
225 goto out_dir;
226 }
227 err = minix_add_link(new_dentry, old_inode); 215 err = minix_add_link(new_dentry, old_inode);
228 if (err) 216 if (err)
229 goto out_dir; 217 goto out_dir;