diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 41e7baabfd9f..0c958cf77758 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -239,6 +239,15 @@ xfs_init_security( | |||
239 | return error; | 239 | return error; |
240 | } | 240 | } |
241 | 241 | ||
242 | static void | ||
243 | xfs_dentry_to_name( | ||
244 | struct xfs_name *namep, | ||
245 | struct dentry *dentry) | ||
246 | { | ||
247 | namep->name = dentry->d_name.name; | ||
248 | namep->len = dentry->d_name.len; | ||
249 | } | ||
250 | |||
242 | STATIC void | 251 | STATIC void |
243 | xfs_cleanup_inode( | 252 | xfs_cleanup_inode( |
244 | struct inode *dir, | 253 | struct inode *dir, |
@@ -246,20 +255,19 @@ xfs_cleanup_inode( | |||
246 | struct dentry *dentry, | 255 | struct dentry *dentry, |
247 | int mode) | 256 | int mode) |
248 | { | 257 | { |
249 | struct dentry teardown = {}; | 258 | struct xfs_name teardown; |
250 | 259 | ||
251 | /* Oh, the horror. | 260 | /* Oh, the horror. |
252 | * If we can't add the ACL or we fail in | 261 | * If we can't add the ACL or we fail in |
253 | * xfs_init_security we must back out. | 262 | * xfs_init_security we must back out. |
254 | * ENOSPC can hit here, among other things. | 263 | * ENOSPC can hit here, among other things. |
255 | */ | 264 | */ |
256 | teardown.d_inode = inode; | 265 | xfs_dentry_to_name(&teardown, dentry); |
257 | teardown.d_name = dentry->d_name; | ||
258 | 266 | ||
259 | if (S_ISDIR(mode)) | 267 | if (S_ISDIR(mode)) |
260 | xfs_rmdir(XFS_I(dir), &teardown); | 268 | xfs_rmdir(XFS_I(dir), &teardown, XFS_I(inode)); |
261 | else | 269 | else |
262 | xfs_remove(XFS_I(dir), &teardown); | 270 | xfs_remove(XFS_I(dir), &teardown, XFS_I(inode)); |
263 | iput(inode); | 271 | iput(inode); |
264 | } | 272 | } |
265 | 273 | ||
@@ -273,6 +281,7 @@ xfs_vn_mknod( | |||
273 | struct inode *inode; | 281 | struct inode *inode; |
274 | struct xfs_inode *ip = NULL; | 282 | struct xfs_inode *ip = NULL; |
275 | xfs_acl_t *default_acl = NULL; | 283 | xfs_acl_t *default_acl = NULL; |
284 | struct xfs_name name; | ||
276 | attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; | 285 | attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; |
277 | int error; | 286 | int error; |
278 | 287 | ||
@@ -293,6 +302,8 @@ xfs_vn_mknod( | |||
293 | } | 302 | } |
294 | } | 303 | } |
295 | 304 | ||
305 | xfs_dentry_to_name(&name, dentry); | ||
306 | |||
296 | if (IS_POSIXACL(dir) && !default_acl) | 307 | if (IS_POSIXACL(dir) && !default_acl) |
297 | mode &= ~current->fs->umask; | 308 | mode &= ~current->fs->umask; |
298 | 309 | ||
@@ -303,10 +314,10 @@ xfs_vn_mknod( | |||
303 | case S_IFSOCK: | 314 | case S_IFSOCK: |
304 | rdev = sysv_encode_dev(rdev); | 315 | rdev = sysv_encode_dev(rdev); |
305 | case S_IFREG: | 316 | case S_IFREG: |
306 | error = xfs_create(XFS_I(dir), dentry, mode, rdev, &ip, NULL); | 317 | error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL); |
307 | break; | 318 | break; |
308 | case S_IFDIR: | 319 | case S_IFDIR: |
309 | error = xfs_mkdir(XFS_I(dir), dentry, mode, &ip, NULL); | 320 | error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL); |
310 | break; | 321 | break; |
311 | default: | 322 | default: |
312 | error = EINVAL; | 323 | error = EINVAL; |
@@ -371,12 +382,14 @@ xfs_vn_lookup( | |||
371 | struct nameidata *nd) | 382 | struct nameidata *nd) |
372 | { | 383 | { |
373 | struct xfs_inode *cip; | 384 | struct xfs_inode *cip; |
385 | struct xfs_name name; | ||
374 | int error; | 386 | int error; |
375 | 387 | ||
376 | if (dentry->d_name.len >= MAXNAMELEN) | 388 | if (dentry->d_name.len >= MAXNAMELEN) |
377 | return ERR_PTR(-ENAMETOOLONG); | 389 | return ERR_PTR(-ENAMETOOLONG); |
378 | 390 | ||
379 | error = xfs_lookup(XFS_I(dir), dentry, &cip); | 391 | xfs_dentry_to_name(&name, dentry); |
392 | error = xfs_lookup(XFS_I(dir), &name, &cip); | ||
380 | if (unlikely(error)) { | 393 | if (unlikely(error)) { |
381 | if (unlikely(error != ENOENT)) | 394 | if (unlikely(error != ENOENT)) |
382 | return ERR_PTR(-error); | 395 | return ERR_PTR(-error); |
@@ -394,12 +407,14 @@ xfs_vn_link( | |||
394 | struct dentry *dentry) | 407 | struct dentry *dentry) |
395 | { | 408 | { |
396 | struct inode *inode; /* inode of guy being linked to */ | 409 | struct inode *inode; /* inode of guy being linked to */ |
410 | struct xfs_name name; | ||
397 | int error; | 411 | int error; |
398 | 412 | ||
399 | inode = old_dentry->d_inode; | 413 | inode = old_dentry->d_inode; |
414 | xfs_dentry_to_name(&name, dentry); | ||
400 | 415 | ||
401 | igrab(inode); | 416 | igrab(inode); |
402 | error = xfs_link(XFS_I(dir), XFS_I(inode), dentry); | 417 | error = xfs_link(XFS_I(dir), XFS_I(inode), &name); |
403 | if (unlikely(error)) { | 418 | if (unlikely(error)) { |
404 | iput(inode); | 419 | iput(inode); |
405 | return -error; | 420 | return -error; |
@@ -417,11 +432,13 @@ xfs_vn_unlink( | |||
417 | struct dentry *dentry) | 432 | struct dentry *dentry) |
418 | { | 433 | { |
419 | struct inode *inode; | 434 | struct inode *inode; |
435 | struct xfs_name name; | ||
420 | int error; | 436 | int error; |
421 | 437 | ||
422 | inode = dentry->d_inode; | 438 | inode = dentry->d_inode; |
439 | xfs_dentry_to_name(&name, dentry); | ||
423 | 440 | ||
424 | error = xfs_remove(XFS_I(dir), dentry); | 441 | error = xfs_remove(XFS_I(dir), &name, XFS_I(inode)); |
425 | if (likely(!error)) { | 442 | if (likely(!error)) { |
426 | xfs_validate_fields(dir); /* size needs update */ | 443 | xfs_validate_fields(dir); /* size needs update */ |
427 | xfs_validate_fields(inode); | 444 | xfs_validate_fields(inode); |
@@ -437,14 +454,15 @@ xfs_vn_symlink( | |||
437 | { | 454 | { |
438 | struct inode *inode; | 455 | struct inode *inode; |
439 | struct xfs_inode *cip = NULL; | 456 | struct xfs_inode *cip = NULL; |
457 | struct xfs_name name; | ||
440 | int error; | 458 | int error; |
441 | mode_t mode; | 459 | mode_t mode; |
442 | 460 | ||
443 | mode = S_IFLNK | | 461 | mode = S_IFLNK | |
444 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); | 462 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); |
463 | xfs_dentry_to_name(&name, dentry); | ||
445 | 464 | ||
446 | error = xfs_symlink(XFS_I(dir), dentry, (char *)symname, mode, | 465 | error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip, NULL); |
447 | &cip, NULL); | ||
448 | if (unlikely(error)) | 466 | if (unlikely(error)) |
449 | goto out; | 467 | goto out; |
450 | 468 | ||
@@ -471,9 +489,12 @@ xfs_vn_rmdir( | |||
471 | struct dentry *dentry) | 489 | struct dentry *dentry) |
472 | { | 490 | { |
473 | struct inode *inode = dentry->d_inode; | 491 | struct inode *inode = dentry->d_inode; |
492 | struct xfs_name name; | ||
474 | int error; | 493 | int error; |
475 | 494 | ||
476 | error = xfs_rmdir(XFS_I(dir), dentry); | 495 | xfs_dentry_to_name(&name, dentry); |
496 | |||
497 | error = xfs_rmdir(XFS_I(dir), &name, XFS_I(inode)); | ||
477 | if (likely(!error)) { | 498 | if (likely(!error)) { |
478 | xfs_validate_fields(inode); | 499 | xfs_validate_fields(inode); |
479 | xfs_validate_fields(dir); | 500 | xfs_validate_fields(dir); |
@@ -489,9 +510,15 @@ xfs_vn_rename( | |||
489 | struct dentry *ndentry) | 510 | struct dentry *ndentry) |
490 | { | 511 | { |
491 | struct inode *new_inode = ndentry->d_inode; | 512 | struct inode *new_inode = ndentry->d_inode; |
513 | struct xfs_name oname; | ||
514 | struct xfs_name nname; | ||
492 | int error; | 515 | int error; |
493 | 516 | ||
494 | error = xfs_rename(XFS_I(odir), odentry, XFS_I(ndir), ndentry); | 517 | xfs_dentry_to_name(&oname, odentry); |
518 | xfs_dentry_to_name(&nname, ndentry); | ||
519 | |||
520 | error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | ||
521 | XFS_I(ndir), &nname); | ||
495 | if (likely(!error)) { | 522 | if (likely(!error)) { |
496 | if (new_inode) | 523 | if (new_inode) |
497 | xfs_validate_fields(new_inode); | 524 | xfs_validate_fields(new_inode); |