aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/jfs
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/Makefile2
-rw-r--r--fs/jfs/acl.c8
-rw-r--r--fs/jfs/file.c6
-rw-r--r--fs/jfs/inode.c3
-rw-r--r--fs/jfs/ioctl.c2
-rw-r--r--fs/jfs/jfs_acl.h2
-rw-r--r--fs/jfs/jfs_dmap.c4
-rw-r--r--fs/jfs/jfs_extent.c6
-rw-r--r--fs/jfs/jfs_imap.c28
-rw-r--r--fs/jfs/jfs_incore.h3
-rw-r--r--fs/jfs/jfs_inode.h2
-rw-r--r--fs/jfs/jfs_logmgr.c25
-rw-r--r--fs/jfs/jfs_logmgr.h2
-rw-r--r--fs/jfs/jfs_metapage.c1
-rw-r--r--fs/jfs/jfs_metapage.h2
-rw-r--r--fs/jfs/jfs_mount.c4
-rw-r--r--fs/jfs/jfs_txnmgr.c4
-rw-r--r--fs/jfs/jfs_xattr.h5
-rw-r--r--fs/jfs/namei.c82
-rw-r--r--fs/jfs/resize.c6
-rw-r--r--fs/jfs/super.c50
-rw-r--r--fs/jfs/xattr.c8
22 files changed, 133 insertions, 122 deletions
diff --git a/fs/jfs/Makefile b/fs/jfs/Makefile
index 3adb6395e42d..a58fa72d7e59 100644
--- a/fs/jfs/Makefile
+++ b/fs/jfs/Makefile
@@ -13,4 +13,4 @@ jfs-y := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
13 13
14jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o 14jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o
15 15
16EXTRA_CFLAGS += -D_JFS_4K 16ccflags-y := -D_JFS_4K
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 1057a4998e4e..e5de9422fa32 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -114,10 +114,14 @@ out:
114 return rc; 114 return rc;
115} 115}
116 116
117int jfs_check_acl(struct inode *inode, int mask) 117int jfs_check_acl(struct inode *inode, int mask, unsigned int flags)
118{ 118{
119 struct posix_acl *acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); 119 struct posix_acl *acl;
120
121 if (flags & IPERM_FLAG_RCU)
122 return -ECHILD;
120 123
124 acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
121 if (IS_ERR(acl)) 125 if (IS_ERR(acl))
122 return PTR_ERR(acl); 126 return PTR_ERR(acl);
123 if (acl) { 127 if (acl) {
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index c5ce6c1d1ff4..2f3f531f3606 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -66,9 +66,9 @@ static int jfs_open(struct inode *inode, struct file *file)
66 struct jfs_inode_info *ji = JFS_IP(inode); 66 struct jfs_inode_info *ji = JFS_IP(inode);
67 spin_lock_irq(&ji->ag_lock); 67 spin_lock_irq(&ji->ag_lock);
68 if (ji->active_ag == -1) { 68 if (ji->active_ag == -1) {
69 ji->active_ag = ji->agno; 69 struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb);
70 atomic_inc( 70 ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb);
71 &JFS_SBI(inode->i_sb)->bmap->db_active[ji->agno]); 71 atomic_inc( &jfs_sb->bmap->db_active[ji->active_ag]);
72 } 72 }
73 spin_unlock_irq(&ji->ag_lock); 73 spin_unlock_irq(&ji->ag_lock);
74 } 74 }
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 9978803ceedc..109655904bbc 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -173,7 +173,7 @@ void jfs_evict_inode(struct inode *inode)
173 dquot_drop(inode); 173 dquot_drop(inode);
174} 174}
175 175
176void jfs_dirty_inode(struct inode *inode) 176void jfs_dirty_inode(struct inode *inode, int flags)
177{ 177{
178 static int noisy = 5; 178 static int noisy = 5;
179 179
@@ -352,7 +352,6 @@ const struct address_space_operations jfs_aops = {
352 .readpages = jfs_readpages, 352 .readpages = jfs_readpages,
353 .writepage = jfs_writepage, 353 .writepage = jfs_writepage,
354 .writepages = jfs_writepages, 354 .writepages = jfs_writepages,
355 .sync_page = block_sync_page,
356 .write_begin = jfs_write_begin, 355 .write_begin = jfs_write_begin,
357 .write_end = nobh_write_end, 356 .write_end = nobh_write_end,
358 .bmap = jfs_bmap, 357 .bmap = jfs_bmap,
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index afe222bf300f..6f98a1866776 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -72,7 +72,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
72 if (err) 72 if (err)
73 return err; 73 return err;
74 74
75 if (!is_owner_or_cap(inode)) { 75 if (!inode_owner_or_capable(inode)) {
76 err = -EACCES; 76 err = -EACCES;
77 goto setflags_out; 77 goto setflags_out;
78 } 78 }
diff --git a/fs/jfs/jfs_acl.h b/fs/jfs/jfs_acl.h
index 54e07559878d..f9285c4900fa 100644
--- a/fs/jfs/jfs_acl.h
+++ b/fs/jfs/jfs_acl.h
@@ -20,7 +20,7 @@
20 20
21#ifdef CONFIG_JFS_POSIX_ACL 21#ifdef CONFIG_JFS_POSIX_ACL
22 22
23int jfs_check_acl(struct inode *, int); 23int jfs_check_acl(struct inode *, int, unsigned int flags);
24int jfs_init_acl(tid_t, struct inode *, struct inode *); 24int jfs_init_acl(tid_t, struct inode *, struct inode *);
25int jfs_acl_chmod(struct inode *inode); 25int jfs_acl_chmod(struct inode *inode);
26 26
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index c92ea3b3ea5e..4496872cf4e7 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1649,7 +1649,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
1649 } 1649 }
1650 1650
1651 /* search the tree within the dmap control page for 1651 /* search the tree within the dmap control page for
1652 * sufficent free space. if sufficient free space is found, 1652 * sufficient free space. if sufficient free space is found,
1653 * dbFindLeaf() returns the index of the leaf at which 1653 * dbFindLeaf() returns the index of the leaf at which
1654 * free space was found. 1654 * free space was found.
1655 */ 1655 */
@@ -2744,7 +2744,7 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval)
2744 /* check which (leafno or buddy) is the left buddy. 2744 /* check which (leafno or buddy) is the left buddy.
2745 * the left buddy gets to claim the blocks resulting 2745 * the left buddy gets to claim the blocks resulting
2746 * from the join while the right gets to claim none. 2746 * from the join while the right gets to claim none.
2747 * the left buddy is also eligable to participate in 2747 * the left buddy is also eligible to participate in
2748 * a join at the next higher level while the right 2748 * a join at the next higher level while the right
2749 * is not. 2749 * is not.
2750 * 2750 *
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 5d3bbd10f8db..e5fe8506ed16 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -126,7 +126,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)
126 126
127 /* allocate the disk blocks for the extent. initially, extBalloc() 127 /* allocate the disk blocks for the extent. initially, extBalloc()
128 * will try to allocate disk blocks for the requested size (xlen). 128 * will try to allocate disk blocks for the requested size (xlen).
129 * if this fails (xlen contiguous free blocks not avaliable), it'll 129 * if this fails (xlen contiguous free blocks not available), it'll
130 * try to allocate a smaller number of blocks (producing a smaller 130 * try to allocate a smaller number of blocks (producing a smaller
131 * extent), with this smaller number of blocks consisting of the 131 * extent), with this smaller number of blocks consisting of the
132 * requested number of blocks rounded down to the next smaller 132 * requested number of blocks rounded down to the next smaller
@@ -481,7 +481,7 @@ int extFill(struct inode *ip, xad_t * xp)
481 * 481 *
482 * initially, we will try to allocate disk blocks for the 482 * initially, we will try to allocate disk blocks for the
483 * requested size (nblocks). if this fails (nblocks 483 * requested size (nblocks). if this fails (nblocks
484 * contiguous free blocks not avaliable), we'll try to allocate 484 * contiguous free blocks not available), we'll try to allocate
485 * a smaller number of blocks (producing a smaller extent), with 485 * a smaller number of blocks (producing a smaller extent), with
486 * this smaller number of blocks consisting of the requested 486 * this smaller number of blocks consisting of the requested
487 * number of blocks rounded down to the next smaller power of 2 487 * number of blocks rounded down to the next smaller power of 2
@@ -575,7 +575,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
575 * to a new set of blocks. If moving the extent, we initially 575 * to a new set of blocks. If moving the extent, we initially
576 * will try to allocate disk blocks for the requested size 576 * will try to allocate disk blocks for the requested size
577 * (newnblks). if this fails (new contiguous free blocks not 577 * (newnblks). if this fails (new contiguous free blocks not
578 * avaliable), we'll try to allocate a smaller number of 578 * available), we'll try to allocate a smaller number of
579 * blocks (producing a smaller extent), with this smaller 579 * blocks (producing a smaller extent), with this smaller
580 * number of blocks consisting of the requested number of 580 * number of blocks consisting of the requested number of
581 * blocks rounded down to the next smaller power of 2 581 * blocks rounded down to the next smaller power of 2
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index f8332dc8eeb2..b78b2f978f04 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -397,7 +397,7 @@ int diRead(struct inode *ip)
397 release_metapage(mp); 397 release_metapage(mp);
398 398
399 /* set the ag for the inode */ 399 /* set the ag for the inode */
400 JFS_IP(ip)->agno = BLKTOAG(agstart, sbi); 400 JFS_IP(ip)->agstart = agstart;
401 JFS_IP(ip)->active_ag = -1; 401 JFS_IP(ip)->active_ag = -1;
402 402
403 return (rc); 403 return (rc);
@@ -497,7 +497,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
497 * appear hashed, but do not put on any lists. hlist_del() 497 * appear hashed, but do not put on any lists. hlist_del()
498 * will work fine and require no locking. 498 * will work fine and require no locking.
499 */ 499 */
500 ip->i_hash.pprev = &ip->i_hash.next; 500 hlist_add_fake(&ip->i_hash);
501 501
502 return (ip); 502 return (ip);
503} 503}
@@ -901,7 +901,7 @@ int diFree(struct inode *ip)
901 901
902 /* get the allocation group for this ino. 902 /* get the allocation group for this ino.
903 */ 903 */
904 agno = JFS_IP(ip)->agno; 904 agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(ip->i_sb));
905 905
906 /* Lock the AG specific inode map information 906 /* Lock the AG specific inode map information
907 */ 907 */
@@ -1069,7 +1069,7 @@ int diFree(struct inode *ip)
1069 */ 1069 */
1070 if (iagp->nfreeexts == cpu_to_le32(EXTSPERIAG - 1)) { 1070 if (iagp->nfreeexts == cpu_to_le32(EXTSPERIAG - 1)) {
1071 /* in preparation for removing the iag from the 1071 /* in preparation for removing the iag from the
1072 * ag extent free list, read the iags preceeding 1072 * ag extent free list, read the iags preceding
1073 * and following the iag on the ag extent free 1073 * and following the iag on the ag extent free
1074 * list. 1074 * list.
1075 */ 1075 */
@@ -1095,7 +1095,7 @@ int diFree(struct inode *ip)
1095 int inofreefwd = le32_to_cpu(iagp->inofreefwd); 1095 int inofreefwd = le32_to_cpu(iagp->inofreefwd);
1096 1096
1097 /* in preparation for removing the iag from the 1097 /* in preparation for removing the iag from the
1098 * ag inode free list, read the iags preceeding 1098 * ag inode free list, read the iags preceding
1099 * and following the iag on the ag inode free 1099 * and following the iag on the ag inode free
1100 * list. before reading these iags, we must make 1100 * list. before reading these iags, we must make
1101 * sure that we already don't have them in hand 1101 * sure that we already don't have them in hand
@@ -1315,12 +1315,11 @@ int diFree(struct inode *ip)
1315static inline void 1315static inline void
1316diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp) 1316diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp)
1317{ 1317{
1318 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
1319 struct jfs_inode_info *jfs_ip = JFS_IP(ip); 1318 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
1320 1319
1321 ip->i_ino = (iagno << L2INOSPERIAG) + ino; 1320 ip->i_ino = (iagno << L2INOSPERIAG) + ino;
1322 jfs_ip->ixpxd = iagp->inoext[extno]; 1321 jfs_ip->ixpxd = iagp->inoext[extno];
1323 jfs_ip->agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi); 1322 jfs_ip->agstart = le64_to_cpu(iagp->agstart);
1324 jfs_ip->active_ag = -1; 1323 jfs_ip->active_ag = -1;
1325} 1324}
1326 1325
@@ -1379,7 +1378,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1379 */ 1378 */
1380 1379
1381 /* get the ag number of this iag */ 1380 /* get the ag number of this iag */
1382 agno = JFS_IP(pip)->agno; 1381 agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb));
1383 1382
1384 if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) { 1383 if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
1385 /* 1384 /*
@@ -1681,7 +1680,7 @@ diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip)
1681 * try to allocate a new extent of free inodes. 1680 * try to allocate a new extent of free inodes.
1682 */ 1681 */
1683 if (addext) { 1682 if (addext) {
1684 /* if free space is not avaliable for this new extent, try 1683 /* if free space is not available for this new extent, try
1685 * below to allocate a free and existing (already backed) 1684 * below to allocate a free and existing (already backed)
1686 * inode from the ag. 1685 * inode from the ag.
1687 */ 1686 */
@@ -2036,7 +2035,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
2036 2035
2037 /* check if this is the last free inode within the iag. 2036 /* check if this is the last free inode within the iag.
2038 * if so, it will have to be removed from the ag free 2037 * if so, it will have to be removed from the ag free
2039 * inode list, so get the iags preceeding and following 2038 * inode list, so get the iags preceding and following
2040 * it on the list. 2039 * it on the list.
2041 */ 2040 */
2042 if (iagp->nfreeinos == cpu_to_le32(1)) { 2041 if (iagp->nfreeinos == cpu_to_le32(1)) {
@@ -2208,7 +2207,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
2208 2207
2209 /* check if this is the last free extent within the 2208 /* check if this is the last free extent within the
2210 * iag. if so, the iag must be removed from the ag 2209 * iag. if so, the iag must be removed from the ag
2211 * free extent list, so get the iags preceeding and 2210 * free extent list, so get the iags preceding and
2212 * following the iag on this list. 2211 * following the iag on this list.
2213 */ 2212 */
2214 if (iagp->nfreeexts == cpu_to_le32(1)) { 2213 if (iagp->nfreeexts == cpu_to_le32(1)) {
@@ -2504,7 +2503,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2504 } 2503 }
2505 2504
2506 2505
2507 /* get the next avaliable iag number */ 2506 /* get the next available iag number */
2508 iagno = imap->im_nextiag; 2507 iagno = imap->im_nextiag;
2509 2508
2510 /* make sure that we have not exceeded the maximum inode 2509 /* make sure that we have not exceeded the maximum inode
@@ -2615,7 +2614,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2615 2614
2616 duplicateIXtree(sb, blkno, xlen, &xaddr); 2615 duplicateIXtree(sb, blkno, xlen, &xaddr);
2617 2616
2618 /* update the next avaliable iag number */ 2617 /* update the next available iag number */
2619 imap->im_nextiag += 1; 2618 imap->im_nextiag += 1;
2620 2619
2621 /* Add the iag to the iag free list so we don't lose the iag 2620 /* Add the iag to the iag free list so we don't lose the iag
@@ -2921,10 +2920,9 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
2921 continue; 2920 continue;
2922 } 2921 }
2923 2922
2924 /* agstart that computes to the same ag is treated as same; */
2925 agstart = le64_to_cpu(iagp->agstart); 2923 agstart = le64_to_cpu(iagp->agstart);
2926 /* iagp->agstart = agstart & ~(mp->db_agsize - 1); */
2927 n = agstart >> mp->db_agl2size; 2924 n = agstart >> mp->db_agl2size;
2925 iagp->agstart = cpu_to_le64((s64)n << mp->db_agl2size);
2928 2926
2929 /* compute backed inodes */ 2927 /* compute backed inodes */
2930 numinos = (EXTSPERIAG - le32_to_cpu(iagp->nfreeexts)) 2928 numinos = (EXTSPERIAG - le32_to_cpu(iagp->nfreeexts))
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index 1439f119ec83..584a4a1a6e81 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -50,8 +50,9 @@ struct jfs_inode_info {
50 short btindex; /* btpage entry index*/ 50 short btindex; /* btpage entry index*/
51 struct inode *ipimap; /* inode map */ 51 struct inode *ipimap; /* inode map */
52 unsigned long cflag; /* commit flags */ 52 unsigned long cflag; /* commit flags */
53 u64 agstart; /* agstart of the containing IAG */
53 u16 bxflag; /* xflag of pseudo buffer? */ 54 u16 bxflag; /* xflag of pseudo buffer? */
54 unchar agno; /* ag number */ 55 unchar pad;
55 signed char active_ag; /* ag currently allocating from */ 56 signed char active_ag; /* ag currently allocating from */
56 lid_t blid; /* lid of pseudo buffer? */ 57 lid_t blid; /* lid of pseudo buffer? */
57 lid_t atlhead; /* anonymous tlock list head */ 58 lid_t atlhead; /* anonymous tlock list head */
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index 155e91eff07d..ec2fb8b945fc 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -28,7 +28,7 @@ extern struct inode *jfs_iget(struct super_block *, unsigned long);
28extern int jfs_commit_inode(struct inode *, int); 28extern int jfs_commit_inode(struct inode *, int);
29extern int jfs_write_inode(struct inode *, struct writeback_control *); 29extern int jfs_write_inode(struct inode *, struct writeback_control *);
30extern void jfs_evict_inode(struct inode *); 30extern void jfs_evict_inode(struct inode *);
31extern void jfs_dirty_inode(struct inode *); 31extern void jfs_dirty_inode(struct inode *, int);
32extern void jfs_truncate(struct inode *); 32extern void jfs_truncate(struct inode *);
33extern void jfs_truncate_nolock(struct inode *, loff_t); 33extern void jfs_truncate_nolock(struct inode *, loff_t);
34extern void jfs_free_zero_link(struct inode *); 34extern void jfs_free_zero_link(struct inode *);
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index c51af2a14516..583636f745e5 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1010,15 +1010,13 @@ static int lmLogSync(struct jfs_log * log, int hard_sync)
1010 * option 2 - shutdown file systems 1010 * option 2 - shutdown file systems
1011 * associated with log ? 1011 * associated with log ?
1012 * option 3 - extend log ? 1012 * option 3 - extend log ?
1013 */
1014 /*
1015 * option 4 - second chance 1013 * option 4 - second chance
1016 * 1014 *
1017 * mark log wrapped, and continue. 1015 * mark log wrapped, and continue.
1018 * when all active transactions are completed, 1016 * when all active transactions are completed,
1019 * mark log vaild for recovery. 1017 * mark log valid for recovery.
1020 * if crashed during invalid state, log state 1018 * if crashed during invalid state, log state
1021 * implies invald log, forcing fsck(). 1019 * implies invalid log, forcing fsck().
1022 */ 1020 */
1023 /* mark log state log wrap in log superblock */ 1021 /* mark log state log wrap in log superblock */
1024 /* log->state = LOGWRAP; */ 1022 /* log->state = LOGWRAP; */
@@ -1122,16 +1120,13 @@ int lmLogOpen(struct super_block *sb)
1122 * file systems to log may have n-to-1 relationship; 1120 * file systems to log may have n-to-1 relationship;
1123 */ 1121 */
1124 1122
1125 bdev = open_by_devnum(sbi->logdev, FMODE_READ|FMODE_WRITE); 1123 bdev = blkdev_get_by_dev(sbi->logdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
1124 log);
1126 if (IS_ERR(bdev)) { 1125 if (IS_ERR(bdev)) {
1127 rc = -PTR_ERR(bdev); 1126 rc = PTR_ERR(bdev);
1128 goto free; 1127 goto free;
1129 } 1128 }
1130 1129
1131 if ((rc = bd_claim(bdev, log))) {
1132 goto close;
1133 }
1134
1135 log->bdev = bdev; 1130 log->bdev = bdev;
1136 memcpy(log->uuid, sbi->loguuid, sizeof(log->uuid)); 1131 memcpy(log->uuid, sbi->loguuid, sizeof(log->uuid));
1137 1132
@@ -1139,7 +1134,7 @@ int lmLogOpen(struct super_block *sb)
1139 * initialize log: 1134 * initialize log:
1140 */ 1135 */
1141 if ((rc = lmLogInit(log))) 1136 if ((rc = lmLogInit(log)))
1142 goto unclaim; 1137 goto close;
1143 1138
1144 list_add(&log->journal_list, &jfs_external_logs); 1139 list_add(&log->journal_list, &jfs_external_logs);
1145 1140
@@ -1165,11 +1160,8 @@ journal_found:
1165 list_del(&log->journal_list); 1160 list_del(&log->journal_list);
1166 lbmLogShutdown(log); 1161 lbmLogShutdown(log);
1167 1162
1168 unclaim:
1169 bd_release(bdev);
1170
1171 close: /* close external log device */ 1163 close: /* close external log device */
1172 blkdev_put(bdev, FMODE_READ|FMODE_WRITE); 1164 blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
1173 1165
1174 free: /* free log descriptor */ 1166 free: /* free log descriptor */
1175 mutex_unlock(&jfs_log_mutex); 1167 mutex_unlock(&jfs_log_mutex);
@@ -1514,8 +1506,7 @@ int lmLogClose(struct super_block *sb)
1514 bdev = log->bdev; 1506 bdev = log->bdev;
1515 rc = lmLogShutdown(log); 1507 rc = lmLogShutdown(log);
1516 1508
1517 bd_release(bdev); 1509 blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
1518 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1519 1510
1520 kfree(log); 1511 kfree(log);
1521 1512
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h
index 9236bc49ae7f..e38c21598850 100644
--- a/fs/jfs/jfs_logmgr.h
+++ b/fs/jfs/jfs_logmgr.h
@@ -288,7 +288,7 @@ struct lrd {
288 /* 288 /*
289 * SYNCPT: log sync point 289 * SYNCPT: log sync point
290 * 290 *
291 * replay log upto syncpt address specified; 291 * replay log up to syncpt address specified;
292 */ 292 */
293 struct { 293 struct {
294 __le32 sync; /* 4: syncpt address (0 = here) */ 294 __le32 sync; /* 4: syncpt address (0 = here) */
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 48b44bd8267b..6740d34cd82b 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -583,7 +583,6 @@ static void metapage_invalidatepage(struct page *page, unsigned long offset)
583const struct address_space_operations jfs_metapage_aops = { 583const struct address_space_operations jfs_metapage_aops = {
584 .readpage = metapage_readpage, 584 .readpage = metapage_readpage,
585 .writepage = metapage_writepage, 585 .writepage = metapage_writepage,
586 .sync_page = block_sync_page,
587 .releasepage = metapage_releasepage, 586 .releasepage = metapage_releasepage,
588 .invalidatepage = metapage_invalidatepage, 587 .invalidatepage = metapage_invalidatepage,
589 .set_page_dirty = __set_page_dirty_nobuffers, 588 .set_page_dirty = __set_page_dirty_nobuffers,
diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h
index d94f8d9e87d7..a78beda85f68 100644
--- a/fs/jfs/jfs_metapage.h
+++ b/fs/jfs/jfs_metapage.h
@@ -75,7 +75,7 @@ extern void grab_metapage(struct metapage *);
75extern void force_metapage(struct metapage *); 75extern void force_metapage(struct metapage *);
76 76
77/* 77/*
78 * hold_metapage and put_metapage are used in conjuction. The page lock 78 * hold_metapage and put_metapage are used in conjunction. The page lock
79 * is not dropped between the two, so no other threads can get or release 79 * is not dropped between the two, so no other threads can get or release
80 * the metapage 80 * the metapage
81 */ 81 */
diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c
index 7b698f2ec45a..9895595fd2f2 100644
--- a/fs/jfs/jfs_mount.c
+++ b/fs/jfs/jfs_mount.c
@@ -97,7 +97,7 @@ int jfs_mount(struct super_block *sb)
97 97
98 ipaimap = diReadSpecial(sb, AGGREGATE_I, 0); 98 ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
99 if (ipaimap == NULL) { 99 if (ipaimap == NULL) {
100 jfs_err("jfs_mount: Faild to read AGGREGATE_I"); 100 jfs_err("jfs_mount: Failed to read AGGREGATE_I");
101 rc = -EIO; 101 rc = -EIO;
102 goto errout20; 102 goto errout20;
103 } 103 }
@@ -148,7 +148,7 @@ int jfs_mount(struct super_block *sb)
148 if ((sbi->mntflag & JFS_BAD_SAIT) == 0) { 148 if ((sbi->mntflag & JFS_BAD_SAIT) == 0) {
149 ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1); 149 ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1);
150 if (!ipaimap2) { 150 if (!ipaimap2) {
151 jfs_err("jfs_mount: Faild to read AGGREGATE_I"); 151 jfs_err("jfs_mount: Failed to read AGGREGATE_I");
152 rc = -EIO; 152 rc = -EIO;
153 goto errout35; 153 goto errout35;
154 } 154 }
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index d945ea76b445..f6cc0c09ec63 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -636,7 +636,7 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
636 * the inode of the page and available to all anonymous 636 * the inode of the page and available to all anonymous
637 * transactions until txCommit() time at which point 637 * transactions until txCommit() time at which point
638 * they are transferred to the transaction tlock list of 638 * they are transferred to the transaction tlock list of
639 * the commiting transaction of the inode) 639 * the committing transaction of the inode)
640 */ 640 */
641 if (xtid == 0) { 641 if (xtid == 0) {
642 tlck->tid = tid; 642 tlck->tid = tid;
@@ -1279,7 +1279,7 @@ int txCommit(tid_t tid, /* transaction identifier */
1279 * lazy commit thread finishes processing 1279 * lazy commit thread finishes processing
1280 */ 1280 */
1281 if (tblk->xflag & COMMIT_DELETE) { 1281 if (tblk->xflag & COMMIT_DELETE) {
1282 atomic_inc(&tblk->u.ip->i_count); 1282 ihold(tblk->u.ip);
1283 /* 1283 /*
1284 * Avoid a rare deadlock 1284 * Avoid a rare deadlock
1285 * 1285 *
diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h
index 88b6cc535bf2..e9e100fd7c09 100644
--- a/fs/jfs/jfs_xattr.h
+++ b/fs/jfs/jfs_xattr.h
@@ -62,10 +62,11 @@ extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
62extern int jfs_removexattr(struct dentry *, const char *); 62extern int jfs_removexattr(struct dentry *, const char *);
63 63
64#ifdef CONFIG_JFS_SECURITY 64#ifdef CONFIG_JFS_SECURITY
65extern int jfs_init_security(tid_t, struct inode *, struct inode *); 65extern int jfs_init_security(tid_t, struct inode *, struct inode *,
66 const struct qstr *);
66#else 67#else
67static inline int jfs_init_security(tid_t tid, struct inode *inode, 68static inline int jfs_init_security(tid_t tid, struct inode *inode,
68 struct inode *dir) 69 struct inode *dir, const struct qstr *qstr)
69{ 70{
70 return 0; 71 return 0;
71} 72}
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index a9cf8e8675be..eaaf2b511e89 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/namei.h>
21#include <linux/ctype.h> 22#include <linux/ctype.h>
22#include <linux/quotaops.h> 23#include <linux/quotaops.h>
23#include <linux/exportfs.h> 24#include <linux/exportfs.h>
@@ -114,7 +115,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
114 if (rc) 115 if (rc)
115 goto out3; 116 goto out3;
116 117
117 rc = jfs_init_security(tid, ip, dip); 118 rc = jfs_init_security(tid, ip, dip, &dentry->d_name);
118 if (rc) { 119 if (rc) {
119 txAbort(tid, 0); 120 txAbort(tid, 0);
120 goto out3; 121 goto out3;
@@ -252,7 +253,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
252 if (rc) 253 if (rc)
253 goto out3; 254 goto out3;
254 255
255 rc = jfs_init_security(tid, ip, dip); 256 rc = jfs_init_security(tid, ip, dip, &dentry->d_name);
256 if (rc) { 257 if (rc) {
257 txAbort(tid, 0); 258 txAbort(tid, 0);
258 goto out3; 259 goto out3;
@@ -808,9 +809,6 @@ static int jfs_link(struct dentry *old_dentry,
808 if (ip->i_nlink == JFS_LINK_MAX) 809 if (ip->i_nlink == JFS_LINK_MAX)
809 return -EMLINK; 810 return -EMLINK;
810 811
811 if (ip->i_nlink == 0)
812 return -ENOENT;
813
814 dquot_initialize(dir); 812 dquot_initialize(dir);
815 813
816 tid = txBegin(ip->i_sb, 0); 814 tid = txBegin(ip->i_sb, 0);
@@ -839,7 +837,7 @@ static int jfs_link(struct dentry *old_dentry,
839 ip->i_ctime = CURRENT_TIME; 837 ip->i_ctime = CURRENT_TIME;
840 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 838 dir->i_ctime = dir->i_mtime = CURRENT_TIME;
841 mark_inode_dirty(dir); 839 mark_inode_dirty(dir);
842 atomic_inc(&ip->i_count); 840 ihold(ip);
843 841
844 iplist[0] = ip; 842 iplist[0] = ip;
845 iplist[1] = dir; 843 iplist[1] = dir;
@@ -931,7 +929,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
931 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); 929 mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
932 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); 930 mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
933 931
934 rc = jfs_init_security(tid, ip, dip); 932 rc = jfs_init_security(tid, ip, dip, &dentry->d_name);
935 if (rc) 933 if (rc)
936 goto out3; 934 goto out3;
937 935
@@ -1394,7 +1392,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1394 if (rc) 1392 if (rc)
1395 goto out3; 1393 goto out3;
1396 1394
1397 rc = jfs_init_security(tid, ip, dir); 1395 rc = jfs_init_security(tid, ip, dir, &dentry->d_name);
1398 if (rc) { 1396 if (rc) {
1399 txAbort(tid, 0); 1397 txAbort(tid, 0);
1400 goto out3; 1398 goto out3;
@@ -1464,9 +1462,6 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
1464 1462
1465 jfs_info("jfs_lookup: name = %s", name); 1463 jfs_info("jfs_lookup: name = %s", name);
1466 1464
1467 if (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2)
1468 dentry->d_op = &jfs_ci_dentry_operations;
1469
1470 if ((name[0] == '.') && (len == 1)) 1465 if ((name[0] == '.') && (len == 1))
1471 inum = dip->i_ino; 1466 inum = dip->i_ino;
1472 else if (strcmp(name, "..") == 0) 1467 else if (strcmp(name, "..") == 0)
@@ -1491,12 +1486,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
1491 return ERR_CAST(ip); 1486 return ERR_CAST(ip);
1492 } 1487 }
1493 1488
1494 dentry = d_splice_alias(ip, dentry); 1489 return d_splice_alias(ip, dentry);
1495
1496 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
1497 dentry->d_op = &jfs_ci_dentry_operations;
1498
1499 return dentry;
1500} 1490}
1501 1491
1502static struct inode *jfs_nfs_get_inode(struct super_block *sb, 1492static struct inode *jfs_nfs_get_inode(struct super_block *sb,
@@ -1573,7 +1563,8 @@ const struct file_operations jfs_dir_operations = {
1573 .llseek = generic_file_llseek, 1563 .llseek = generic_file_llseek,
1574}; 1564};
1575 1565
1576static int jfs_ci_hash(struct dentry *dir, struct qstr *this) 1566static int jfs_ci_hash(const struct dentry *dir, const struct inode *inode,
1567 struct qstr *this)
1577{ 1568{
1578 unsigned long hash; 1569 unsigned long hash;
1579 int i; 1570 int i;
@@ -1586,32 +1577,63 @@ static int jfs_ci_hash(struct dentry *dir, struct qstr *this)
1586 return 0; 1577 return 0;
1587} 1578}
1588 1579
1589static int jfs_ci_compare(struct dentry *dir, struct qstr *a, struct qstr *b) 1580static int jfs_ci_compare(const struct dentry *parent,
1581 const struct inode *pinode,
1582 const struct dentry *dentry, const struct inode *inode,
1583 unsigned int len, const char *str, const struct qstr *name)
1590{ 1584{
1591 int i, result = 1; 1585 int i, result = 1;
1592 1586
1593 if (a->len != b->len) 1587 if (len != name->len)
1594 goto out; 1588 goto out;
1595 for (i=0; i < a->len; i++) { 1589 for (i=0; i < len; i++) {
1596 if (tolower(a->name[i]) != tolower(b->name[i])) 1590 if (tolower(str[i]) != tolower(name->name[i]))
1597 goto out; 1591 goto out;
1598 } 1592 }
1599 result = 0; 1593 result = 0;
1594out:
1595 return result;
1596}
1600 1597
1598static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd)
1599{
1600 if (nd && nd->flags & LOOKUP_RCU)
1601 return -ECHILD;
1601 /* 1602 /*
1602 * We want creates to preserve case. A negative dentry, a, that 1603 * This is not negative dentry. Always valid.
1603 * has a different case than b may cause a new entry to be created 1604 *
1604 * with the wrong case. Since we can't tell if a comes from a negative 1605 * Note, rename() to existing directory entry will have ->d_inode,
1605 * dentry, we blindly replace it with b. This should be harmless if 1606 * and will use existing name which isn't specified name by user.
1606 * a is not a negative dentry. 1607 *
1608 * We may be able to drop this positive dentry here. But dropping
1609 * positive dentry isn't good idea. So it's unsupported like
1610 * rename("filename", "FILENAME") for now.
1607 */ 1611 */
1608 memcpy((unsigned char *)a->name, b->name, a->len); 1612 if (dentry->d_inode)
1609out: 1613 return 1;
1610 return result; 1614
1615 /*
1616 * This may be nfsd (or something), anyway, we can't see the
1617 * intent of this. So, since this can be for creation, drop it.
1618 */
1619 if (!nd)
1620 return 0;
1621
1622 /*
1623 * Drop the negative dentry, in order to make sure to use the
1624 * case sensitive name which is specified by user if this is
1625 * for creation.
1626 */
1627 if (!(nd->flags & (LOOKUP_CONTINUE | LOOKUP_PARENT))) {
1628 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
1629 return 0;
1630 }
1631 return 1;
1611} 1632}
1612 1633
1613const struct dentry_operations jfs_ci_dentry_operations = 1634const struct dentry_operations jfs_ci_dentry_operations =
1614{ 1635{
1615 .d_hash = jfs_ci_hash, 1636 .d_hash = jfs_ci_hash,
1616 .d_compare = jfs_ci_compare, 1637 .d_compare = jfs_ci_compare,
1638 .d_revalidate = jfs_ci_revalidate,
1617}; 1639};
diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
index 1aba0039f1c9..8d0c1c7c0820 100644
--- a/fs/jfs/resize.c
+++ b/fs/jfs/resize.c
@@ -57,7 +57,7 @@
57 * 2. compute new FSCKSize from new LVSize; 57 * 2. compute new FSCKSize from new LVSize;
58 * 3. set new FSSize as MIN(FSSize, LVSize-(LogSize+FSCKSize)) where 58 * 3. set new FSSize as MIN(FSSize, LVSize-(LogSize+FSCKSize)) where
59 * assert(new FSSize >= old FSSize), 59 * assert(new FSSize >= old FSSize),
60 * i.e., file system must not be shrinked; 60 * i.e., file system must not be shrunk;
61 */ 61 */
62int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) 62int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
63{ 63{
@@ -80,7 +80,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
80 int log_formatted = 0; 80 int log_formatted = 0;
81 struct inode *iplist[1]; 81 struct inode *iplist[1];
82 struct jfs_superblock *j_sb, *j_sb2; 82 struct jfs_superblock *j_sb, *j_sb2;
83 uint old_agsize; 83 s64 old_agsize;
84 int agsizechanged = 0; 84 int agsizechanged = 0;
85 struct buffer_head *bh, *bh2; 85 struct buffer_head *bh, *bh2;
86 86
@@ -182,7 +182,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
182 */ 182 */
183 newFSSize = newLVSize - newLogSize - newFSCKSize; 183 newFSSize = newLVSize - newLogSize - newFSCKSize;
184 184
185 /* file system cannot be shrinked */ 185 /* file system cannot be shrunk */
186 if (newFSSize < bmp->db_mapsize) { 186 if (newFSSize < bmp->db_mapsize) {
187 rc = -EINVAL; 187 rc = -EINVAL;
188 goto out; 188 goto out;
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index ec8c3e4baca3..06c8a67cbe76 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -33,7 +33,6 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <linux/seq_file.h> 35#include <linux/seq_file.h>
36#include <linux/smp_lock.h>
37 36
38#include "jfs_incore.h" 37#include "jfs_incore.h"
39#include "jfs_filsys.h" 38#include "jfs_filsys.h"
@@ -116,6 +115,14 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
116 return &jfs_inode->vfs_inode; 115 return &jfs_inode->vfs_inode;
117} 116}
118 117
118static void jfs_i_callback(struct rcu_head *head)
119{
120 struct inode *inode = container_of(head, struct inode, i_rcu);
121 struct jfs_inode_info *ji = JFS_IP(inode);
122 INIT_LIST_HEAD(&inode->i_dentry);
123 kmem_cache_free(jfs_inode_cachep, ji);
124}
125
119static void jfs_destroy_inode(struct inode *inode) 126static void jfs_destroy_inode(struct inode *inode)
120{ 127{
121 struct jfs_inode_info *ji = JFS_IP(inode); 128 struct jfs_inode_info *ji = JFS_IP(inode);
@@ -129,7 +136,7 @@ static void jfs_destroy_inode(struct inode *inode)
129 ji->active_ag = -1; 136 ji->active_ag = -1;
130 } 137 }
131 spin_unlock_irq(&ji->ag_lock); 138 spin_unlock_irq(&ji->ag_lock);
132 kmem_cache_free(jfs_inode_cachep, ji); 139 call_rcu(&inode->i_rcu, jfs_i_callback);
133} 140}
134 141
135static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) 142static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -176,8 +183,6 @@ static void jfs_put_super(struct super_block *sb)
176 183
177 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 184 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
178 185
179 lock_kernel();
180
181 rc = jfs_umount(sb); 186 rc = jfs_umount(sb);
182 if (rc) 187 if (rc)
183 jfs_err("jfs_umount failed with return code %d", rc); 188 jfs_err("jfs_umount failed with return code %d", rc);
@@ -188,8 +193,6 @@ static void jfs_put_super(struct super_block *sb)
188 iput(sbi->direct_inode); 193 iput(sbi->direct_inode);
189 194
190 kfree(sbi); 195 kfree(sbi);
191
192 unlock_kernel();
193} 196}
194 197
195enum { 198enum {
@@ -369,19 +372,16 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
369 if (!parse_options(data, sb, &newLVSize, &flag)) { 372 if (!parse_options(data, sb, &newLVSize, &flag)) {
370 return -EINVAL; 373 return -EINVAL;
371 } 374 }
372 lock_kernel(); 375
373 if (newLVSize) { 376 if (newLVSize) {
374 if (sb->s_flags & MS_RDONLY) { 377 if (sb->s_flags & MS_RDONLY) {
375 printk(KERN_ERR 378 printk(KERN_ERR
376 "JFS: resize requires volume to be mounted read-write\n"); 379 "JFS: resize requires volume to be mounted read-write\n");
377 unlock_kernel();
378 return -EROFS; 380 return -EROFS;
379 } 381 }
380 rc = jfs_extendfs(sb, newLVSize, 0); 382 rc = jfs_extendfs(sb, newLVSize, 0);
381 if (rc) { 383 if (rc)
382 unlock_kernel();
383 return rc; 384 return rc;
384 }
385 } 385 }
386 386
387 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 387 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
@@ -397,36 +397,30 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
397 /* mark the fs r/w for quota activity */ 397 /* mark the fs r/w for quota activity */
398 sb->s_flags &= ~MS_RDONLY; 398 sb->s_flags &= ~MS_RDONLY;
399 399
400 unlock_kernel();
401 dquot_resume(sb, -1); 400 dquot_resume(sb, -1);
402 return ret; 401 return ret;
403 } 402 }
404 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { 403 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
405 rc = dquot_suspend(sb, -1); 404 rc = dquot_suspend(sb, -1);
406 if (rc < 0) { 405 if (rc < 0) {
407 unlock_kernel();
408 return rc; 406 return rc;
409 } 407 }
410 rc = jfs_umount_rw(sb); 408 rc = jfs_umount_rw(sb);
411 JFS_SBI(sb)->flag = flag; 409 JFS_SBI(sb)->flag = flag;
412 unlock_kernel();
413 return rc; 410 return rc;
414 } 411 }
415 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) 412 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY))
416 if (!(sb->s_flags & MS_RDONLY)) { 413 if (!(sb->s_flags & MS_RDONLY)) {
417 rc = jfs_umount_rw(sb); 414 rc = jfs_umount_rw(sb);
418 if (rc) { 415 if (rc)
419 unlock_kernel();
420 return rc; 416 return rc;
421 } 417
422 JFS_SBI(sb)->flag = flag; 418 JFS_SBI(sb)->flag = flag;
423 ret = jfs_mount_rw(sb, 1); 419 ret = jfs_mount_rw(sb, 1);
424 unlock_kernel();
425 return ret; 420 return ret;
426 } 421 }
427 JFS_SBI(sb)->flag = flag; 422 JFS_SBI(sb)->flag = flag;
428 423
429 unlock_kernel();
430 return 0; 424 return 0;
431} 425}
432 426
@@ -446,6 +440,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
446 sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); 440 sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL);
447 if (!sbi) 441 if (!sbi)
448 return -ENOMEM; 442 return -ENOMEM;
443
449 sb->s_fs_info = sbi; 444 sb->s_fs_info = sbi;
450 sbi->sb = sb; 445 sbi->sb = sb;
451 sbi->uid = sbi->gid = sbi->umask = -1; 446 sbi->uid = sbi->gid = sbi->umask = -1;
@@ -520,6 +515,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
520 515
521 sb->s_magic = JFS_SUPER_MAGIC; 516 sb->s_magic = JFS_SUPER_MAGIC;
522 517
518 if (sbi->mntflag & JFS_OS2)
519 sb->s_d_op = &jfs_ci_dentry_operations;
520
523 inode = jfs_iget(sb, ROOT_I); 521 inode = jfs_iget(sb, ROOT_I);
524 if (IS_ERR(inode)) { 522 if (IS_ERR(inode)) {
525 ret = PTR_ERR(inode); 523 ret = PTR_ERR(inode);
@@ -529,9 +527,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
529 if (!sb->s_root) 527 if (!sb->s_root)
530 goto out_no_root; 528 goto out_no_root;
531 529
532 if (sbi->mntflag & JFS_OS2)
533 sb->s_root->d_op = &jfs_ci_dentry_operations;
534
535 /* logical blocks are represented by 40 bits in pxd_t, etc. */ 530 /* logical blocks are represented by 40 bits in pxd_t, etc. */
536 sb->s_maxbytes = ((u64) sb->s_blocksize) << 40; 531 sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
537#if BITS_PER_LONG == 32 532#if BITS_PER_LONG == 32
@@ -596,11 +591,10 @@ static int jfs_unfreeze(struct super_block *sb)
596 return 0; 591 return 0;
597} 592}
598 593
599static int jfs_get_sb(struct file_system_type *fs_type, 594static struct dentry *jfs_do_mount(struct file_system_type *fs_type,
600 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 595 int flags, const char *dev_name, void *data)
601{ 596{
602 return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super, 597 return mount_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
603 mnt);
604} 598}
605 599
606static int jfs_sync_fs(struct super_block *sb, int wait) 600static int jfs_sync_fs(struct super_block *sb, int wait)
@@ -650,7 +644,7 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
650 644
651/* Read data from quotafile - avoid pagecache and such because we cannot afford 645/* Read data from quotafile - avoid pagecache and such because we cannot afford
652 * acquiring the locks... As quota files are never truncated and quota code 646 * acquiring the locks... As quota files are never truncated and quota code
653 * itself serializes the operations (and noone else should touch the files) 647 * itself serializes the operations (and no one else should touch the files)
654 * we don't have to be afraid of races */ 648 * we don't have to be afraid of races */
655static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data, 649static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
656 size_t len, loff_t off) 650 size_t len, loff_t off)
@@ -783,7 +777,7 @@ static const struct export_operations jfs_export_operations = {
783static struct file_system_type jfs_fs_type = { 777static struct file_system_type jfs_fs_type = {
784 .owner = THIS_MODULE, 778 .owner = THIS_MODULE,
785 .name = "jfs", 779 .name = "jfs",
786 .get_sb = jfs_get_sb, 780 .mount = jfs_do_mount,
787 .kill_sb = kill_block_super, 781 .kill_sb = kill_block_super,
788 .fs_flags = FS_REQUIRES_DEV, 782 .fs_flags = FS_REQUIRES_DEV,
789}; 783};
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 2d7f165d0f1d..24838f1eeee5 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -678,7 +678,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
678 struct posix_acl *acl; 678 struct posix_acl *acl;
679 int rc; 679 int rc;
680 680
681 if (!is_owner_or_cap(inode)) 681 if (!inode_owner_or_capable(inode))
682 return -EPERM; 682 return -EPERM;
683 683
684 /* 684 /*
@@ -1091,7 +1091,8 @@ int jfs_removexattr(struct dentry *dentry, const char *name)
1091} 1091}
1092 1092
1093#ifdef CONFIG_JFS_SECURITY 1093#ifdef CONFIG_JFS_SECURITY
1094int jfs_init_security(tid_t tid, struct inode *inode, struct inode *dir) 1094int jfs_init_security(tid_t tid, struct inode *inode, struct inode *dir,
1095 const struct qstr *qstr)
1095{ 1096{
1096 int rc; 1097 int rc;
1097 size_t len; 1098 size_t len;
@@ -1099,7 +1100,8 @@ int jfs_init_security(tid_t tid, struct inode *inode, struct inode *dir)
1099 char *suffix; 1100 char *suffix;
1100 char *name; 1101 char *name;
1101 1102
1102 rc = security_inode_init_security(inode, dir, &suffix, &value, &len); 1103 rc = security_inode_init_security(inode, dir, qstr, &suffix, &value,
1104 &len);
1103 if (rc) { 1105 if (rc) {
1104 if (rc == -EOPNOTSUPP) 1106 if (rc == -EOPNOTSUPP)
1105 return 0; 1107 return 0;