diff options
Diffstat (limited to 'fs/9p/vfs_inode_dotl.c')
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 07f409288d1b..61e4fa70a6fa 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -330,14 +330,14 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, | |||
330 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 330 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
331 | goto error; | 331 | goto error; |
332 | } | 332 | } |
333 | /* Now set the ACL based on the default value */ | ||
334 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
335 | |||
333 | err = v9fs_fid_add(dentry, fid); | 336 | err = v9fs_fid_add(dentry, fid); |
334 | if (err < 0) | 337 | if (err < 0) |
335 | goto error; | 338 | goto error; |
336 | d_instantiate(dentry, inode); | 339 | d_instantiate(dentry, inode); |
337 | 340 | ||
338 | /* Now set the ACL based on the default value */ | ||
339 | v9fs_set_create_acl(dentry, &dacl, &pacl); | ||
340 | |||
341 | v9inode = V9FS_I(inode); | 341 | v9inode = V9FS_I(inode); |
342 | mutex_lock(&v9inode->v_mutex); | 342 | mutex_lock(&v9inode->v_mutex); |
343 | if (v9ses->cache && !v9inode->writeback_fid && | 343 | if (v9ses->cache && !v9inode->writeback_fid && |
@@ -369,6 +369,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, | |||
369 | #endif | 369 | #endif |
370 | *opened |= FILE_CREATED; | 370 | *opened |= FILE_CREATED; |
371 | out: | 371 | out: |
372 | v9fs_put_acl(dacl, pacl); | ||
372 | dput(res); | 373 | dput(res); |
373 | return err; | 374 | return err; |
374 | 375 | ||
@@ -378,7 +379,6 @@ error: | |||
378 | err_clunk_old_fid: | 379 | err_clunk_old_fid: |
379 | if (ofid) | 380 | if (ofid) |
380 | p9_client_clunk(ofid); | 381 | p9_client_clunk(ofid); |
381 | v9fs_set_create_acl(NULL, &dacl, &pacl); | ||
382 | goto out; | 382 | goto out; |
383 | } | 383 | } |
384 | 384 | ||
@@ -435,17 +435,17 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
435 | if (err < 0) | 435 | if (err < 0) |
436 | goto error; | 436 | goto error; |
437 | 437 | ||
438 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
439 | if (IS_ERR(fid)) { | ||
440 | err = PTR_ERR(fid); | ||
441 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
442 | err); | ||
443 | fid = NULL; | ||
444 | goto error; | ||
445 | } | ||
446 | |||
438 | /* instantiate inode and assign the unopened fid to the dentry */ | 447 | /* instantiate inode and assign the unopened fid to the dentry */ |
439 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | 448 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
440 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
441 | if (IS_ERR(fid)) { | ||
442 | err = PTR_ERR(fid); | ||
443 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
444 | err); | ||
445 | fid = NULL; | ||
446 | goto error; | ||
447 | } | ||
448 | |||
449 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); | 449 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
450 | if (IS_ERR(inode)) { | 450 | if (IS_ERR(inode)) { |
451 | err = PTR_ERR(inode); | 451 | err = PTR_ERR(inode); |
@@ -456,6 +456,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
456 | err = v9fs_fid_add(dentry, fid); | 456 | err = v9fs_fid_add(dentry, fid); |
457 | if (err < 0) | 457 | if (err < 0) |
458 | goto error; | 458 | goto error; |
459 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
459 | d_instantiate(dentry, inode); | 460 | d_instantiate(dentry, inode); |
460 | fid = NULL; | 461 | fid = NULL; |
461 | } else { | 462 | } else { |
@@ -469,16 +470,15 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
469 | err = PTR_ERR(inode); | 470 | err = PTR_ERR(inode); |
470 | goto error; | 471 | goto error; |
471 | } | 472 | } |
473 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
472 | d_instantiate(dentry, inode); | 474 | d_instantiate(dentry, inode); |
473 | } | 475 | } |
474 | /* Now set the ACL based on the default value */ | ||
475 | v9fs_set_create_acl(dentry, &dacl, &pacl); | ||
476 | inc_nlink(dir); | 476 | inc_nlink(dir); |
477 | v9fs_invalidate_inode_attr(dir); | 477 | v9fs_invalidate_inode_attr(dir); |
478 | error: | 478 | error: |
479 | if (fid) | 479 | if (fid) |
480 | p9_client_clunk(fid); | 480 | p9_client_clunk(fid); |
481 | v9fs_set_create_acl(NULL, &dacl, &pacl); | 481 | v9fs_put_acl(dacl, pacl); |
482 | return err; | 482 | return err; |
483 | } | 483 | } |
484 | 484 | ||
@@ -572,10 +572,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
572 | struct v9fs_session_info *v9ses; | 572 | struct v9fs_session_info *v9ses; |
573 | struct p9_fid *fid; | 573 | struct p9_fid *fid; |
574 | struct p9_iattr_dotl p9attr; | 574 | struct p9_iattr_dotl p9attr; |
575 | struct inode *inode = dentry->d_inode; | ||
575 | 576 | ||
576 | p9_debug(P9_DEBUG_VFS, "\n"); | 577 | p9_debug(P9_DEBUG_VFS, "\n"); |
577 | 578 | ||
578 | retval = inode_change_ok(dentry->d_inode, iattr); | 579 | retval = inode_change_ok(inode, iattr); |
579 | if (retval) | 580 | if (retval) |
580 | return retval; | 581 | return retval; |
581 | 582 | ||
@@ -596,23 +597,23 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
596 | return PTR_ERR(fid); | 597 | return PTR_ERR(fid); |
597 | 598 | ||
598 | /* Write all dirty data */ | 599 | /* Write all dirty data */ |
599 | if (S_ISREG(dentry->d_inode->i_mode)) | 600 | if (S_ISREG(inode->i_mode)) |
600 | filemap_write_and_wait(dentry->d_inode->i_mapping); | 601 | filemap_write_and_wait(inode->i_mapping); |
601 | 602 | ||
602 | retval = p9_client_setattr(fid, &p9attr); | 603 | retval = p9_client_setattr(fid, &p9attr); |
603 | if (retval < 0) | 604 | if (retval < 0) |
604 | return retval; | 605 | return retval; |
605 | 606 | ||
606 | if ((iattr->ia_valid & ATTR_SIZE) && | 607 | if ((iattr->ia_valid & ATTR_SIZE) && |
607 | iattr->ia_size != i_size_read(dentry->d_inode)) | 608 | iattr->ia_size != i_size_read(inode)) |
608 | truncate_setsize(dentry->d_inode, iattr->ia_size); | 609 | truncate_setsize(inode, iattr->ia_size); |
609 | 610 | ||
610 | v9fs_invalidate_inode_attr(dentry->d_inode); | 611 | v9fs_invalidate_inode_attr(inode); |
611 | setattr_copy(dentry->d_inode, iattr); | 612 | setattr_copy(inode, iattr); |
612 | mark_inode_dirty(dentry->d_inode); | 613 | mark_inode_dirty(inode); |
613 | if (iattr->ia_valid & ATTR_MODE) { | 614 | if (iattr->ia_valid & ATTR_MODE) { |
614 | /* We also want to update ACL when we update mode bits */ | 615 | /* We also want to update ACL when we update mode bits */ |
615 | retval = v9fs_acl_chmod(dentry); | 616 | retval = v9fs_acl_chmod(inode, fid); |
616 | if (retval < 0) | 617 | if (retval < 0) |
617 | return retval; | 618 | return retval; |
618 | } | 619 | } |
@@ -880,17 +881,17 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, | |||
880 | goto error; | 881 | goto error; |
881 | 882 | ||
882 | v9fs_invalidate_inode_attr(dir); | 883 | v9fs_invalidate_inode_attr(dir); |
884 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
885 | if (IS_ERR(fid)) { | ||
886 | err = PTR_ERR(fid); | ||
887 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
888 | err); | ||
889 | fid = NULL; | ||
890 | goto error; | ||
891 | } | ||
892 | |||
883 | /* instantiate inode and assign the unopened fid to the dentry */ | 893 | /* instantiate inode and assign the unopened fid to the dentry */ |
884 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | 894 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
885 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
886 | if (IS_ERR(fid)) { | ||
887 | err = PTR_ERR(fid); | ||
888 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
889 | err); | ||
890 | fid = NULL; | ||
891 | goto error; | ||
892 | } | ||
893 | |||
894 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); | 895 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
895 | if (IS_ERR(inode)) { | 896 | if (IS_ERR(inode)) { |
896 | err = PTR_ERR(inode); | 897 | err = PTR_ERR(inode); |
@@ -898,6 +899,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, | |||
898 | err); | 899 | err); |
899 | goto error; | 900 | goto error; |
900 | } | 901 | } |
902 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
901 | err = v9fs_fid_add(dentry, fid); | 903 | err = v9fs_fid_add(dentry, fid); |
902 | if (err < 0) | 904 | if (err < 0) |
903 | goto error; | 905 | goto error; |
@@ -913,14 +915,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, | |||
913 | err = PTR_ERR(inode); | 915 | err = PTR_ERR(inode); |
914 | goto error; | 916 | goto error; |
915 | } | 917 | } |
918 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
916 | d_instantiate(dentry, inode); | 919 | d_instantiate(dentry, inode); |
917 | } | 920 | } |
918 | /* Now set the ACL based on the default value */ | ||
919 | v9fs_set_create_acl(dentry, &dacl, &pacl); | ||
920 | error: | 921 | error: |
921 | if (fid) | 922 | if (fid) |
922 | p9_client_clunk(fid); | 923 | p9_client_clunk(fid); |
923 | v9fs_set_create_acl(NULL, &dacl, &pacl); | 924 | v9fs_put_acl(dacl, pacl); |
924 | return err; | 925 | return err; |
925 | } | 926 | } |
926 | 927 | ||