aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/acl.c73
-rw-r--r--fs/jfs/file.c13
-rw-r--r--fs/jfs/inode.c4
-rw-r--r--fs/jfs/jfs_acl.h2
-rw-r--r--fs/jfs/jfs_dmap.c5
-rw-r--r--fs/jfs/jfs_inode.h2
-rw-r--r--fs/jfs/jfs_txnmgr.c6
-rw-r--r--fs/jfs/jfs_umount.c4
-rw-r--r--fs/jfs/namei.c54
-rw-r--r--fs/jfs/xattr.c4
10 files changed, 60 insertions, 107 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index e5de9422fa3..45559dc3ea2 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -27,7 +27,7 @@
27#include "jfs_xattr.h" 27#include "jfs_xattr.h"
28#include "jfs_acl.h" 28#include "jfs_acl.h"
29 29
30static struct posix_acl *jfs_get_acl(struct inode *inode, int type) 30struct posix_acl *jfs_get_acl(struct inode *inode, int type)
31{ 31{
32 struct posix_acl *acl; 32 struct posix_acl *acl;
33 char *ea_name; 33 char *ea_name;
@@ -114,30 +114,9 @@ out:
114 return rc; 114 return rc;
115} 115}
116 116
117int jfs_check_acl(struct inode *inode, int mask, unsigned int flags)
118{
119 struct posix_acl *acl;
120
121 if (flags & IPERM_FLAG_RCU)
122 return -ECHILD;
123
124 acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
125 if (IS_ERR(acl))
126 return PTR_ERR(acl);
127 if (acl) {
128 int error = posix_acl_permission(inode, acl, mask);
129 posix_acl_release(acl);
130 return error;
131 }
132
133 return -EAGAIN;
134}
135
136int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir) 117int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
137{ 118{
138 struct posix_acl *acl = NULL; 119 struct posix_acl *acl = NULL;
139 struct posix_acl *clone;
140 mode_t mode;
141 int rc = 0; 120 int rc = 0;
142 121
143 if (S_ISLNK(inode->i_mode)) 122 if (S_ISLNK(inode->i_mode))
@@ -153,20 +132,11 @@ int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
153 if (rc) 132 if (rc)
154 goto cleanup; 133 goto cleanup;
155 } 134 }
156 clone = posix_acl_clone(acl, GFP_KERNEL); 135 rc = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode);
157 if (!clone) { 136 if (rc < 0)
158 rc = -ENOMEM; 137 goto cleanup; /* posix_acl_release(NULL) is no-op */
159 goto cleanup; 138 if (rc > 0)
160 } 139 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, acl);
161 mode = inode->i_mode;
162 rc = posix_acl_create_masq(clone, &mode);
163 if (rc >= 0) {
164 inode->i_mode = mode;
165 if (rc > 0)
166 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS,
167 clone);
168 }
169 posix_acl_release(clone);
170cleanup: 140cleanup:
171 posix_acl_release(acl); 141 posix_acl_release(acl);
172 } else 142 } else
@@ -180,8 +150,9 @@ cleanup:
180 150
181int jfs_acl_chmod(struct inode *inode) 151int jfs_acl_chmod(struct inode *inode)
182{ 152{
183 struct posix_acl *acl, *clone; 153 struct posix_acl *acl;
184 int rc; 154 int rc;
155 tid_t tid;
185 156
186 if (S_ISLNK(inode->i_mode)) 157 if (S_ISLNK(inode->i_mode))
187 return -EOPNOTSUPP; 158 return -EOPNOTSUPP;
@@ -190,22 +161,18 @@ int jfs_acl_chmod(struct inode *inode)
190 if (IS_ERR(acl) || !acl) 161 if (IS_ERR(acl) || !acl)
191 return PTR_ERR(acl); 162 return PTR_ERR(acl);
192 163
193 clone = posix_acl_clone(acl, GFP_KERNEL); 164 rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
194 posix_acl_release(acl); 165 if (rc)
195 if (!clone) 166 return rc;
196 return -ENOMEM;
197
198 rc = posix_acl_chmod_masq(clone, inode->i_mode);
199 if (!rc) {
200 tid_t tid = txBegin(inode->i_sb, 0);
201 mutex_lock(&JFS_IP(inode)->commit_mutex);
202 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
203 if (!rc)
204 rc = txCommit(tid, 1, &inode, 0);
205 txEnd(tid);
206 mutex_unlock(&JFS_IP(inode)->commit_mutex);
207 }
208 167
209 posix_acl_release(clone); 168 tid = txBegin(inode->i_sb, 0);
169 mutex_lock(&JFS_IP(inode)->commit_mutex);
170 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, acl);
171 if (!rc)
172 rc = txCommit(tid, 1, &inode, 0);
173 txEnd(tid);
174 mutex_unlock(&JFS_IP(inode)->commit_mutex);
175
176 posix_acl_release(acl);
210 return rc; 177 return rc;
211} 178}
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 2f3f531f360..844f9460cb1 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -28,19 +28,26 @@
28#include "jfs_acl.h" 28#include "jfs_acl.h"
29#include "jfs_debug.h" 29#include "jfs_debug.h"
30 30
31int jfs_fsync(struct file *file, int datasync) 31int jfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
32{ 32{
33 struct inode *inode = file->f_mapping->host; 33 struct inode *inode = file->f_mapping->host;
34 int rc = 0; 34 int rc = 0;
35 35
36 rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
37 if (rc)
38 return rc;
39
40 mutex_lock(&inode->i_mutex);
36 if (!(inode->i_state & I_DIRTY) || 41 if (!(inode->i_state & I_DIRTY) ||
37 (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) { 42 (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) {
38 /* Make sure committed changes hit the disk */ 43 /* Make sure committed changes hit the disk */
39 jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1); 44 jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1);
45 mutex_unlock(&inode->i_mutex);
40 return rc; 46 return rc;
41 } 47 }
42 48
43 rc |= jfs_commit_inode(inode, 1); 49 rc |= jfs_commit_inode(inode, 1);
50 mutex_unlock(&inode->i_mutex);
44 51
45 return rc ? -EIO : 0; 52 return rc ? -EIO : 0;
46} 53}
@@ -110,6 +117,8 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
110 117
111 if ((iattr->ia_valid & ATTR_SIZE) && 118 if ((iattr->ia_valid & ATTR_SIZE) &&
112 iattr->ia_size != i_size_read(inode)) { 119 iattr->ia_size != i_size_read(inode)) {
120 inode_dio_wait(inode);
121
113 rc = vmtruncate(inode, iattr->ia_size); 122 rc = vmtruncate(inode, iattr->ia_size);
114 if (rc) 123 if (rc)
115 return rc; 124 return rc;
@@ -131,7 +140,7 @@ const struct inode_operations jfs_file_inode_operations = {
131 .removexattr = jfs_removexattr, 140 .removexattr = jfs_removexattr,
132 .setattr = jfs_setattr, 141 .setattr = jfs_setattr,
133#ifdef CONFIG_JFS_POSIX_ACL 142#ifdef CONFIG_JFS_POSIX_ACL
134 .check_acl = jfs_check_acl, 143 .get_acl = jfs_get_acl,
135#endif 144#endif
136}; 145};
137 146
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 109655904bb..77b69b27f82 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -329,8 +329,8 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
329 struct inode *inode = file->f_mapping->host; 329 struct inode *inode = file->f_mapping->host;
330 ssize_t ret; 330 ssize_t ret;
331 331
332 ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 332 ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
333 offset, nr_segs, jfs_get_block, NULL); 333 jfs_get_block);
334 334
335 /* 335 /*
336 * In case of error extending write may have instantiated a few 336 * In case of error extending write may have instantiated a few
diff --git a/fs/jfs/jfs_acl.h b/fs/jfs/jfs_acl.h
index f9285c4900f..ad84fe50ca9 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, unsigned int flags); 23struct posix_acl *jfs_get_acl(struct inode *inode, int type);
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 4496872cf4e..9cbd11a3f80 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -3161,7 +3161,7 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
3161{ 3161{
3162 int rc; 3162 int rc;
3163 int dbitno, word, rembits, nb, nwords, wbitno, agno; 3163 int dbitno, word, rembits, nb, nwords, wbitno, agno;
3164 s8 oldroot, *leaf; 3164 s8 oldroot;
3165 struct dmaptree *tp = (struct dmaptree *) & dp->tree; 3165 struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3166 3166
3167 /* save the current value of the root (i.e. maximum free string) 3167 /* save the current value of the root (i.e. maximum free string)
@@ -3169,9 +3169,6 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
3169 */ 3169 */
3170 oldroot = tp->stree[ROOT]; 3170 oldroot = tp->stree[ROOT];
3171 3171
3172 /* pick up a pointer to the leaves of the dmap tree */
3173 leaf = tp->stree + LEAFIND;
3174
3175 /* determine the bit number and word within the dmap of the 3172 /* determine the bit number and word within the dmap of the
3176 * starting block. 3173 * starting block.
3177 */ 3174 */
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index ec2fb8b945f..9271cfe4a14 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -21,7 +21,7 @@
21struct fid; 21struct fid;
22 22
23extern struct inode *ialloc(struct inode *, umode_t); 23extern struct inode *ialloc(struct inode *, umode_t);
24extern int jfs_fsync(struct file *, int); 24extern int jfs_fsync(struct file *, loff_t, loff_t, int);
25extern long jfs_ioctl(struct file *, unsigned int, unsigned long); 25extern long jfs_ioctl(struct file *, unsigned int, unsigned long);
26extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long); 26extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long);
27extern struct inode *jfs_iget(struct super_block *, unsigned long); 27extern struct inode *jfs_iget(struct super_block *, unsigned long);
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index f6cc0c09ec6..af9606057dd 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1143,7 +1143,6 @@ int txCommit(tid_t tid, /* transaction identifier */
1143 struct jfs_log *log; 1143 struct jfs_log *log;
1144 struct tblock *tblk; 1144 struct tblock *tblk;
1145 struct lrd *lrd; 1145 struct lrd *lrd;
1146 int lsn;
1147 struct inode *ip; 1146 struct inode *ip;
1148 struct jfs_inode_info *jfs_ip; 1147 struct jfs_inode_info *jfs_ip;
1149 int k, n; 1148 int k, n;
@@ -1310,7 +1309,7 @@ int txCommit(tid_t tid, /* transaction identifier */
1310 */ 1309 */
1311 lrd->type = cpu_to_le16(LOG_COMMIT); 1310 lrd->type = cpu_to_le16(LOG_COMMIT);
1312 lrd->length = 0; 1311 lrd->length = 0;
1313 lsn = lmLog(log, tblk, lrd, NULL); 1312 lmLog(log, tblk, lrd, NULL);
1314 1313
1315 lmGroupCommit(log, tblk); 1314 lmGroupCommit(log, tblk);
1316 1315
@@ -2935,7 +2934,6 @@ int jfs_sync(void *arg)
2935{ 2934{
2936 struct inode *ip; 2935 struct inode *ip;
2937 struct jfs_inode_info *jfs_ip; 2936 struct jfs_inode_info *jfs_ip;
2938 int rc;
2939 tid_t tid; 2937 tid_t tid;
2940 2938
2941 do { 2939 do {
@@ -2961,7 +2959,7 @@ int jfs_sync(void *arg)
2961 */ 2959 */
2962 TXN_UNLOCK(); 2960 TXN_UNLOCK();
2963 tid = txBegin(ip->i_sb, COMMIT_INODE); 2961 tid = txBegin(ip->i_sb, COMMIT_INODE);
2964 rc = txCommit(tid, 1, &ip, 0); 2962 txCommit(tid, 1, &ip, 0);
2965 txEnd(tid); 2963 txEnd(tid);
2966 mutex_unlock(&jfs_ip->commit_mutex); 2964 mutex_unlock(&jfs_ip->commit_mutex);
2967 2965
diff --git a/fs/jfs/jfs_umount.c b/fs/jfs/jfs_umount.c
index adcf92d3b60..7971f37534a 100644
--- a/fs/jfs/jfs_umount.c
+++ b/fs/jfs/jfs_umount.c
@@ -68,7 +68,7 @@ int jfs_umount(struct super_block *sb)
68 /* 68 /*
69 * Wait for outstanding transactions to be written to log: 69 * Wait for outstanding transactions to be written to log:
70 */ 70 */
71 jfs_flush_journal(log, 1); 71 jfs_flush_journal(log, 2);
72 72
73 /* 73 /*
74 * close fileset inode allocation map (aka fileset inode) 74 * close fileset inode allocation map (aka fileset inode)
@@ -146,7 +146,7 @@ int jfs_umount_rw(struct super_block *sb)
146 * 146 *
147 * remove file system from log active file system list. 147 * remove file system from log active file system list.
148 */ 148 */
149 jfs_flush_journal(log, 1); 149 jfs_flush_journal(log, 2);
150 150
151 /* 151 /*
152 * Make sure all metadata makes it to disk 152 * Make sure all metadata makes it to disk
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index eaaf2b511e8..e17545e1566 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -893,7 +893,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
893 unchar *i_fastsymlink; 893 unchar *i_fastsymlink;
894 s64 xlen = 0; 894 s64 xlen = 0;
895 int bmask = 0, xsize; 895 int bmask = 0, xsize;
896 s64 extent = 0, xaddr; 896 s64 xaddr;
897 struct metapage *mp; 897 struct metapage *mp;
898 struct super_block *sb; 898 struct super_block *sb;
899 struct tblock *tblk; 899 struct tblock *tblk;
@@ -993,7 +993,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
993 txAbort(tid, 0); 993 txAbort(tid, 0);
994 goto out3; 994 goto out3;
995 } 995 }
996 extent = xaddr;
997 ip->i_size = ssize - 1; 996 ip->i_size = ssize - 1;
998 while (ssize) { 997 while (ssize) {
999 /* This is kind of silly since PATH_MAX == 4K */ 998 /* This is kind of silly since PATH_MAX == 4K */
@@ -1456,34 +1455,23 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
1456 ino_t inum; 1455 ino_t inum;
1457 struct inode *ip; 1456 struct inode *ip;
1458 struct component_name key; 1457 struct component_name key;
1459 const char *name = dentry->d_name.name;
1460 int len = dentry->d_name.len;
1461 int rc; 1458 int rc;
1462 1459
1463 jfs_info("jfs_lookup: name = %s", name); 1460 jfs_info("jfs_lookup: name = %s", dentry->d_name.name);
1464 1461
1465 if ((name[0] == '.') && (len == 1)) 1462 if ((rc = get_UCSname(&key, dentry)))
1466 inum = dip->i_ino; 1463 return ERR_PTR(rc);
1467 else if (strcmp(name, "..") == 0) 1464 rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP);
1468 inum = PARENT(dip); 1465 free_UCSname(&key);
1469 else { 1466 if (rc == -ENOENT) {
1470 if ((rc = get_UCSname(&key, dentry))) 1467 ip = NULL;
1471 return ERR_PTR(rc); 1468 } else if (rc) {
1472 rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP); 1469 jfs_err("jfs_lookup: dtSearch returned %d", rc);
1473 free_UCSname(&key); 1470 ip = ERR_PTR(rc);
1474 if (rc == -ENOENT) { 1471 } else {
1475 d_add(dentry, NULL); 1472 ip = jfs_iget(dip->i_sb, inum);
1476 return NULL; 1473 if (IS_ERR(ip))
1477 } else if (rc) { 1474 jfs_err("jfs_lookup: iget failed on inum %d", (uint)inum);
1478 jfs_err("jfs_lookup: dtSearch returned %d", rc);
1479 return ERR_PTR(rc);
1480 }
1481 }
1482
1483 ip = jfs_iget(dip->i_sb, inum);
1484 if (IS_ERR(ip)) {
1485 jfs_err("jfs_lookup: iget failed on inum %d", (uint) inum);
1486 return ERR_CAST(ip);
1487 } 1475 }
1488 1476
1489 return d_splice_alias(ip, dentry); 1477 return d_splice_alias(ip, dentry);
@@ -1548,7 +1536,7 @@ const struct inode_operations jfs_dir_inode_operations = {
1548 .removexattr = jfs_removexattr, 1536 .removexattr = jfs_removexattr,
1549 .setattr = jfs_setattr, 1537 .setattr = jfs_setattr,
1550#ifdef CONFIG_JFS_POSIX_ACL 1538#ifdef CONFIG_JFS_POSIX_ACL
1551 .check_acl = jfs_check_acl, 1539 .get_acl = jfs_get_acl,
1552#endif 1540#endif
1553}; 1541};
1554 1542
@@ -1597,8 +1585,6 @@ out:
1597 1585
1598static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd) 1586static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd)
1599{ 1587{
1600 if (nd && nd->flags & LOOKUP_RCU)
1601 return -ECHILD;
1602 /* 1588 /*
1603 * This is not negative dentry. Always valid. 1589 * This is not negative dentry. Always valid.
1604 * 1590 *
@@ -1624,10 +1610,8 @@ static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd)
1624 * case sensitive name which is specified by user if this is 1610 * case sensitive name which is specified by user if this is
1625 * for creation. 1611 * for creation.
1626 */ 1612 */
1627 if (!(nd->flags & (LOOKUP_CONTINUE | LOOKUP_PARENT))) { 1613 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
1628 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 1614 return 0;
1629 return 0;
1630 }
1631 return 1; 1615 return 1;
1632} 1616}
1633 1617
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 24838f1eeee..e87fedef23d 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -693,8 +693,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
693 return rc; 693 return rc;
694 } 694 }
695 if (acl) { 695 if (acl) {
696 mode_t mode = inode->i_mode; 696 rc = posix_acl_equiv_mode(acl, &inode->i_mode);
697 rc = posix_acl_equiv_mode(acl, &mode);
698 posix_acl_release(acl); 697 posix_acl_release(acl);
699 if (rc < 0) { 698 if (rc < 0) {
700 printk(KERN_ERR 699 printk(KERN_ERR
@@ -702,7 +701,6 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
702 rc); 701 rc);
703 return rc; 702 return rc;
704 } 703 }
705 inode->i_mode = mode;
706 mark_inode_dirty(inode); 704 mark_inode_dirty(inode);
707 } 705 }
708 /* 706 /*