aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/namei.c')
-rw-r--r--fs/jfs/namei.c63
1 files changed, 42 insertions, 21 deletions
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 49ccde3937f9..f23f9c2aa525 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -39,6 +39,24 @@ struct dentry_operations jfs_ci_dentry_operations;
39static s64 commitZeroLink(tid_t, struct inode *); 39static s64 commitZeroLink(tid_t, struct inode *);
40 40
41/* 41/*
42 * NAME: free_ea_wmap(inode)
43 *
44 * FUNCTION: free uncommitted extended attributes from working map
45 *
46 */
47static inline void free_ea_wmap(struct inode *inode)
48{
49 dxd_t *ea = &JFS_IP(inode)->ea;
50
51 if (ea->flag & DXD_EXTENT) {
52 /* free EA pages from cache */
53 invalidate_dxd_metapages(inode, *ea);
54 dbFree(inode, addressDXD(ea), lengthDXD(ea));
55 }
56 ea->flag = 0;
57}
58
59/*
42 * NAME: jfs_create(dip, dentry, mode) 60 * NAME: jfs_create(dip, dentry, mode)
43 * 61 *
44 * FUNCTION: create a regular file in the parent directory <dip> 62 * FUNCTION: create a regular file in the parent directory <dip>
@@ -89,8 +107,13 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
89 down(&JFS_IP(dip)->commit_sem); 107 down(&JFS_IP(dip)->commit_sem);
90 down(&JFS_IP(ip)->commit_sem); 108 down(&JFS_IP(ip)->commit_sem);
91 109
110 rc = jfs_init_acl(tid, ip, dip);
111 if (rc)
112 goto out3;
113
92 if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { 114 if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) {
93 jfs_err("jfs_create: dtSearch returned %d", rc); 115 jfs_err("jfs_create: dtSearch returned %d", rc);
116 txAbort(tid, 0);
94 goto out3; 117 goto out3;
95 } 118 }
96 119
@@ -139,6 +162,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
139 up(&JFS_IP(dip)->commit_sem); 162 up(&JFS_IP(dip)->commit_sem);
140 up(&JFS_IP(ip)->commit_sem); 163 up(&JFS_IP(ip)->commit_sem);
141 if (rc) { 164 if (rc) {
165 free_ea_wmap(ip);
142 ip->i_nlink = 0; 166 ip->i_nlink = 0;
143 iput(ip); 167 iput(ip);
144 } else 168 } else
@@ -147,11 +171,6 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
147 out2: 171 out2:
148 free_UCSname(&dname); 172 free_UCSname(&dname);
149 173
150#ifdef CONFIG_JFS_POSIX_ACL
151 if (rc == 0)
152 jfs_init_acl(ip, dip);
153#endif
154
155 out1: 174 out1:
156 175
157 jfs_info("jfs_create: rc:%d", rc); 176 jfs_info("jfs_create: rc:%d", rc);
@@ -216,8 +235,13 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
216 down(&JFS_IP(dip)->commit_sem); 235 down(&JFS_IP(dip)->commit_sem);
217 down(&JFS_IP(ip)->commit_sem); 236 down(&JFS_IP(ip)->commit_sem);
218 237
238 rc = jfs_init_acl(tid, ip, dip);
239 if (rc)
240 goto out3;
241
219 if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { 242 if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) {
220 jfs_err("jfs_mkdir: dtSearch returned %d", rc); 243 jfs_err("jfs_mkdir: dtSearch returned %d", rc);
244 txAbort(tid, 0);
221 goto out3; 245 goto out3;
222 } 246 }
223 247
@@ -267,6 +291,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
267 up(&JFS_IP(dip)->commit_sem); 291 up(&JFS_IP(dip)->commit_sem);
268 up(&JFS_IP(ip)->commit_sem); 292 up(&JFS_IP(ip)->commit_sem);
269 if (rc) { 293 if (rc) {
294 free_ea_wmap(ip);
270 ip->i_nlink = 0; 295 ip->i_nlink = 0;
271 iput(ip); 296 iput(ip);
272 } else 297 } else
@@ -275,10 +300,6 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
275 out2: 300 out2:
276 free_UCSname(&dname); 301 free_UCSname(&dname);
277 302
278#ifdef CONFIG_JFS_POSIX_ACL
279 if (rc == 0)
280 jfs_init_acl(ip, dip);
281#endif
282 303
283 out1: 304 out1:
284 305
@@ -1000,6 +1021,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1000 up(&JFS_IP(dip)->commit_sem); 1021 up(&JFS_IP(dip)->commit_sem);
1001 up(&JFS_IP(ip)->commit_sem); 1022 up(&JFS_IP(ip)->commit_sem);
1002 if (rc) { 1023 if (rc) {
1024 free_ea_wmap(ip);
1003 ip->i_nlink = 0; 1025 ip->i_nlink = 0;
1004 iput(ip); 1026 iput(ip);
1005 } else 1027 } else
@@ -1008,11 +1030,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1008 out2: 1030 out2:
1009 free_UCSname(&dname); 1031 free_UCSname(&dname);
1010 1032
1011#ifdef CONFIG_JFS_POSIX_ACL
1012 if (rc == 0)
1013 jfs_init_acl(ip, dip);
1014#endif
1015
1016 out1: 1033 out1:
1017 jfs_info("jfs_symlink: rc:%d", rc); 1034 jfs_info("jfs_symlink: rc:%d", rc);
1018 return rc; 1035 return rc;
@@ -1328,17 +1345,25 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1328 down(&JFS_IP(dir)->commit_sem); 1345 down(&JFS_IP(dir)->commit_sem);
1329 down(&JFS_IP(ip)->commit_sem); 1346 down(&JFS_IP(ip)->commit_sem);
1330 1347
1331 if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) 1348 rc = jfs_init_acl(tid, ip, dir);
1349 if (rc)
1332 goto out3; 1350 goto out3;
1333 1351
1352 if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) {
1353 txAbort(tid, 0);
1354 goto out3;
1355 }
1356
1334 tblk = tid_to_tblock(tid); 1357 tblk = tid_to_tblock(tid);
1335 tblk->xflag |= COMMIT_CREATE; 1358 tblk->xflag |= COMMIT_CREATE;
1336 tblk->ino = ip->i_ino; 1359 tblk->ino = ip->i_ino;
1337 tblk->u.ixpxd = JFS_IP(ip)->ixpxd; 1360 tblk->u.ixpxd = JFS_IP(ip)->ixpxd;
1338 1361
1339 ino = ip->i_ino; 1362 ino = ip->i_ino;
1340 if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) 1363 if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) {
1364 txAbort(tid, 0);
1341 goto out3; 1365 goto out3;
1366 }
1342 1367
1343 ip->i_op = &jfs_file_inode_operations; 1368 ip->i_op = &jfs_file_inode_operations;
1344 jfs_ip->dev = new_encode_dev(rdev); 1369 jfs_ip->dev = new_encode_dev(rdev);
@@ -1360,6 +1385,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1360 up(&JFS_IP(ip)->commit_sem); 1385 up(&JFS_IP(ip)->commit_sem);
1361 up(&JFS_IP(dir)->commit_sem); 1386 up(&JFS_IP(dir)->commit_sem);
1362 if (rc) { 1387 if (rc) {
1388 free_ea_wmap(ip);
1363 ip->i_nlink = 0; 1389 ip->i_nlink = 0;
1364 iput(ip); 1390 iput(ip);
1365 } else 1391 } else
@@ -1368,11 +1394,6 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1368 out1: 1394 out1:
1369 free_UCSname(&dname); 1395 free_UCSname(&dname);
1370 1396
1371#ifdef CONFIG_JFS_POSIX_ACL
1372 if (rc == 0)
1373 jfs_init_acl(ip, dir);
1374#endif
1375
1376 out: 1397 out:
1377 jfs_info("jfs_mknod: returning %d", rc); 1398 jfs_info("jfs_mknod: returning %d", rc);
1378 return rc; 1399 return rc;