diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-11 13:14:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-11 13:14:54 -0400 |
commit | 32983696a48a6c41d99f3eca82ba7510a552d843 (patch) | |
tree | ab793556d6a9d2d4e0f366eed58e74b8e705cd8c /fs/jfs/namei.c | |
parent | ce1289adeb67b5480f35cb257cbf6e9881153783 (diff) | |
parent | 1d15b10f95d4c4295a0f2288c7be7b6a005490da (diff) |
Merge branch 'for-linus' from kernel.org:/.../shaggy/jfs-2.6 manually
Clash due to new delete_inode behavior (the filesystem now needs to do
the truncate_inode_pages() call itself).
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jfs/namei.c')
-rw-r--r-- | fs/jfs/namei.c | 85 |
1 files changed, 64 insertions, 21 deletions
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 49ccde3937f9..1abe7343f920 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -39,6 +39,24 @@ struct dentry_operations jfs_ci_dentry_operations; | |||
39 | static s64 commitZeroLink(tid_t, struct inode *); | 39 | static 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 | */ | ||
47 | static 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,19 @@ 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 | |||
114 | rc = jfs_init_security(tid, ip, dip); | ||
115 | if (rc) { | ||
116 | txAbort(tid, 0); | ||
117 | goto out3; | ||
118 | } | ||
119 | |||
92 | if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { | 120 | if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { |
93 | jfs_err("jfs_create: dtSearch returned %d", rc); | 121 | jfs_err("jfs_create: dtSearch returned %d", rc); |
122 | txAbort(tid, 0); | ||
94 | goto out3; | 123 | goto out3; |
95 | } | 124 | } |
96 | 125 | ||
@@ -139,6 +168,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, | |||
139 | up(&JFS_IP(dip)->commit_sem); | 168 | up(&JFS_IP(dip)->commit_sem); |
140 | up(&JFS_IP(ip)->commit_sem); | 169 | up(&JFS_IP(ip)->commit_sem); |
141 | if (rc) { | 170 | if (rc) { |
171 | free_ea_wmap(ip); | ||
142 | ip->i_nlink = 0; | 172 | ip->i_nlink = 0; |
143 | iput(ip); | 173 | iput(ip); |
144 | } else | 174 | } else |
@@ -147,11 +177,6 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, | |||
147 | out2: | 177 | out2: |
148 | free_UCSname(&dname); | 178 | free_UCSname(&dname); |
149 | 179 | ||
150 | #ifdef CONFIG_JFS_POSIX_ACL | ||
151 | if (rc == 0) | ||
152 | jfs_init_acl(ip, dip); | ||
153 | #endif | ||
154 | |||
155 | out1: | 180 | out1: |
156 | 181 | ||
157 | jfs_info("jfs_create: rc:%d", rc); | 182 | jfs_info("jfs_create: rc:%d", rc); |
@@ -216,8 +241,19 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | |||
216 | down(&JFS_IP(dip)->commit_sem); | 241 | down(&JFS_IP(dip)->commit_sem); |
217 | down(&JFS_IP(ip)->commit_sem); | 242 | down(&JFS_IP(ip)->commit_sem); |
218 | 243 | ||
244 | rc = jfs_init_acl(tid, ip, dip); | ||
245 | if (rc) | ||
246 | goto out3; | ||
247 | |||
248 | rc = jfs_init_security(tid, ip, dip); | ||
249 | if (rc) { | ||
250 | txAbort(tid, 0); | ||
251 | goto out3; | ||
252 | } | ||
253 | |||
219 | if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { | 254 | if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { |
220 | jfs_err("jfs_mkdir: dtSearch returned %d", rc); | 255 | jfs_err("jfs_mkdir: dtSearch returned %d", rc); |
256 | txAbort(tid, 0); | ||
221 | goto out3; | 257 | goto out3; |
222 | } | 258 | } |
223 | 259 | ||
@@ -267,6 +303,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | |||
267 | up(&JFS_IP(dip)->commit_sem); | 303 | up(&JFS_IP(dip)->commit_sem); |
268 | up(&JFS_IP(ip)->commit_sem); | 304 | up(&JFS_IP(ip)->commit_sem); |
269 | if (rc) { | 305 | if (rc) { |
306 | free_ea_wmap(ip); | ||
270 | ip->i_nlink = 0; | 307 | ip->i_nlink = 0; |
271 | iput(ip); | 308 | iput(ip); |
272 | } else | 309 | } else |
@@ -275,10 +312,6 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | |||
275 | out2: | 312 | out2: |
276 | free_UCSname(&dname); | 313 | free_UCSname(&dname); |
277 | 314 | ||
278 | #ifdef CONFIG_JFS_POSIX_ACL | ||
279 | if (rc == 0) | ||
280 | jfs_init_acl(ip, dip); | ||
281 | #endif | ||
282 | 315 | ||
283 | out1: | 316 | out1: |
284 | 317 | ||
@@ -885,6 +918,10 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
885 | down(&JFS_IP(dip)->commit_sem); | 918 | down(&JFS_IP(dip)->commit_sem); |
886 | down(&JFS_IP(ip)->commit_sem); | 919 | down(&JFS_IP(ip)->commit_sem); |
887 | 920 | ||
921 | rc = jfs_init_security(tid, ip, dip); | ||
922 | if (rc) | ||
923 | goto out3; | ||
924 | |||
888 | tblk = tid_to_tblock(tid); | 925 | tblk = tid_to_tblock(tid); |
889 | tblk->xflag |= COMMIT_CREATE; | 926 | tblk->xflag |= COMMIT_CREATE; |
890 | tblk->ino = ip->i_ino; | 927 | tblk->ino = ip->i_ino; |
@@ -1000,6 +1037,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
1000 | up(&JFS_IP(dip)->commit_sem); | 1037 | up(&JFS_IP(dip)->commit_sem); |
1001 | up(&JFS_IP(ip)->commit_sem); | 1038 | up(&JFS_IP(ip)->commit_sem); |
1002 | if (rc) { | 1039 | if (rc) { |
1040 | free_ea_wmap(ip); | ||
1003 | ip->i_nlink = 0; | 1041 | ip->i_nlink = 0; |
1004 | iput(ip); | 1042 | iput(ip); |
1005 | } else | 1043 | } else |
@@ -1008,11 +1046,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
1008 | out2: | 1046 | out2: |
1009 | free_UCSname(&dname); | 1047 | free_UCSname(&dname); |
1010 | 1048 | ||
1011 | #ifdef CONFIG_JFS_POSIX_ACL | ||
1012 | if (rc == 0) | ||
1013 | jfs_init_acl(ip, dip); | ||
1014 | #endif | ||
1015 | |||
1016 | out1: | 1049 | out1: |
1017 | jfs_info("jfs_symlink: rc:%d", rc); | 1050 | jfs_info("jfs_symlink: rc:%d", rc); |
1018 | return rc; | 1051 | return rc; |
@@ -1328,8 +1361,20 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, | |||
1328 | down(&JFS_IP(dir)->commit_sem); | 1361 | down(&JFS_IP(dir)->commit_sem); |
1329 | down(&JFS_IP(ip)->commit_sem); | 1362 | down(&JFS_IP(ip)->commit_sem); |
1330 | 1363 | ||
1331 | if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) | 1364 | rc = jfs_init_acl(tid, ip, dir); |
1365 | if (rc) | ||
1366 | goto out3; | ||
1367 | |||
1368 | rc = jfs_init_security(tid, ip, dir); | ||
1369 | if (rc) { | ||
1370 | txAbort(tid, 0); | ||
1332 | goto out3; | 1371 | goto out3; |
1372 | } | ||
1373 | |||
1374 | if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) { | ||
1375 | txAbort(tid, 0); | ||
1376 | goto out3; | ||
1377 | } | ||
1333 | 1378 | ||
1334 | tblk = tid_to_tblock(tid); | 1379 | tblk = tid_to_tblock(tid); |
1335 | tblk->xflag |= COMMIT_CREATE; | 1380 | tblk->xflag |= COMMIT_CREATE; |
@@ -1337,8 +1382,10 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, | |||
1337 | tblk->u.ixpxd = JFS_IP(ip)->ixpxd; | 1382 | tblk->u.ixpxd = JFS_IP(ip)->ixpxd; |
1338 | 1383 | ||
1339 | ino = ip->i_ino; | 1384 | ino = ip->i_ino; |
1340 | if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) | 1385 | if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) { |
1386 | txAbort(tid, 0); | ||
1341 | goto out3; | 1387 | goto out3; |
1388 | } | ||
1342 | 1389 | ||
1343 | ip->i_op = &jfs_file_inode_operations; | 1390 | ip->i_op = &jfs_file_inode_operations; |
1344 | jfs_ip->dev = new_encode_dev(rdev); | 1391 | jfs_ip->dev = new_encode_dev(rdev); |
@@ -1360,6 +1407,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, | |||
1360 | up(&JFS_IP(ip)->commit_sem); | 1407 | up(&JFS_IP(ip)->commit_sem); |
1361 | up(&JFS_IP(dir)->commit_sem); | 1408 | up(&JFS_IP(dir)->commit_sem); |
1362 | if (rc) { | 1409 | if (rc) { |
1410 | free_ea_wmap(ip); | ||
1363 | ip->i_nlink = 0; | 1411 | ip->i_nlink = 0; |
1364 | iput(ip); | 1412 | iput(ip); |
1365 | } else | 1413 | } else |
@@ -1368,11 +1416,6 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, | |||
1368 | out1: | 1416 | out1: |
1369 | free_UCSname(&dname); | 1417 | free_UCSname(&dname); |
1370 | 1418 | ||
1371 | #ifdef CONFIG_JFS_POSIX_ACL | ||
1372 | if (rc == 0) | ||
1373 | jfs_init_acl(ip, dir); | ||
1374 | #endif | ||
1375 | |||
1376 | out: | 1419 | out: |
1377 | jfs_info("jfs_mknod: returning %d", rc); | 1420 | jfs_info("jfs_mknod: returning %d", rc); |
1378 | return rc; | 1421 | return rc; |