aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_iops.c')
-rw-r--r--fs/xfs/xfs_iops.c69
1 files changed, 39 insertions, 30 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index b9c172b3fbbe..23ce927973a4 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -70,9 +70,8 @@ xfs_synchronize_times(
70} 70}
71 71
72/* 72/*
73 * If the linux inode is valid, mark it dirty. 73 * If the linux inode is valid, mark it dirty, else mark the dirty state
74 * Used when committing a dirty inode into a transaction so that 74 * in the XFS inode to make sure we pick it up when reclaiming the inode.
75 * the inode will get written back by the linux code
76 */ 75 */
77void 76void
78xfs_mark_inode_dirty_sync( 77xfs_mark_inode_dirty_sync(
@@ -82,6 +81,10 @@ xfs_mark_inode_dirty_sync(
82 81
83 if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) 82 if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
84 mark_inode_dirty_sync(inode); 83 mark_inode_dirty_sync(inode);
84 else {
85 barrier();
86 ip->i_update_core = 1;
87 }
85} 88}
86 89
87void 90void
@@ -92,6 +95,28 @@ xfs_mark_inode_dirty(
92 95
93 if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) 96 if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
94 mark_inode_dirty(inode); 97 mark_inode_dirty(inode);
98 else {
99 barrier();
100 ip->i_update_core = 1;
101 }
102
103}
104
105
106int xfs_initxattrs(struct inode *inode, const struct xattr *xattr_array,
107 void *fs_info)
108{
109 const struct xattr *xattr;
110 struct xfs_inode *ip = XFS_I(inode);
111 int error = 0;
112
113 for (xattr = xattr_array; xattr->name != NULL; xattr++) {
114 error = xfs_attr_set(ip, xattr->name, xattr->value,
115 xattr->value_len, ATTR_SECURE);
116 if (error < 0)
117 break;
118 }
119 return error;
95} 120}
96 121
97/* 122/*
@@ -100,31 +125,15 @@ xfs_mark_inode_dirty(
100 * these attrs can be journalled at inode creation time (along with the 125 * these attrs can be journalled at inode creation time (along with the
101 * inode, of course, such that log replay can't cause these to be lost). 126 * inode, of course, such that log replay can't cause these to be lost).
102 */ 127 */
128
103STATIC int 129STATIC int
104xfs_init_security( 130xfs_init_security(
105 struct inode *inode, 131 struct inode *inode,
106 struct inode *dir, 132 struct inode *dir,
107 const struct qstr *qstr) 133 const struct qstr *qstr)
108{ 134{
109 struct xfs_inode *ip = XFS_I(inode); 135 return security_inode_init_security(inode, dir, qstr,
110 size_t length; 136 &xfs_initxattrs, NULL);
111 void *value;
112 unsigned char *name;
113 int error;
114
115 error = security_inode_init_security(inode, dir, qstr, (char **)&name,
116 &value, &length);
117 if (error) {
118 if (error == -EOPNOTSUPP)
119 return 0;
120 return -error;
121 }
122
123 error = xfs_attr_set(ip, name, value, length, ATTR_SECURE);
124
125 kfree(name);
126 kfree(value);
127 return error;
128} 137}
129 138
130static void 139static void
@@ -457,7 +466,7 @@ xfs_vn_getattr(
457 trace_xfs_getattr(ip); 466 trace_xfs_getattr(ip);
458 467
459 if (XFS_FORCED_SHUTDOWN(mp)) 468 if (XFS_FORCED_SHUTDOWN(mp))
460 return XFS_ERROR(EIO); 469 return -XFS_ERROR(EIO);
461 470
462 stat->size = XFS_ISIZE(ip); 471 stat->size = XFS_ISIZE(ip);
463 stat->dev = inode->i_sb->s_dev; 472 stat->dev = inode->i_sb->s_dev;
@@ -603,7 +612,7 @@ xfs_setattr_nonsize(
603 } 612 }
604 } 613 }
605 614
606 xfs_trans_ijoin(tp, ip); 615 xfs_trans_ijoin(tp, ip, 0);
607 616
608 /* 617 /*
609 * Change file ownership. Must be the owner or privileged. 618 * Change file ownership. Must be the owner or privileged.
@@ -825,16 +834,16 @@ xfs_setattr_size(
825 * care about here. 834 * care about here.
826 */ 835 */
827 if (ip->i_size != ip->i_d.di_size && iattr->ia_size > ip->i_d.di_size) { 836 if (ip->i_size != ip->i_d.di_size && iattr->ia_size > ip->i_d.di_size) {
828 error = xfs_flush_pages(ip, ip->i_d.di_size, iattr->ia_size, 837 error = xfs_flush_pages(ip, ip->i_d.di_size, iattr->ia_size, 0,
829 XBF_ASYNC, FI_NONE); 838 FI_NONE);
830 if (error) 839 if (error)
831 goto out_unlock; 840 goto out_unlock;
832 } 841 }
833 842
834 /* 843 /*
835 * Wait for all I/O to complete. 844 * Wait for all direct I/O to complete.
836 */ 845 */
837 xfs_ioend_wait(ip); 846 inode_dio_wait(inode);
838 847
839 error = -block_truncate_page(inode->i_mapping, iattr->ia_size, 848 error = -block_truncate_page(inode->i_mapping, iattr->ia_size,
840 xfs_get_blocks); 849 xfs_get_blocks);
@@ -855,7 +864,7 @@ xfs_setattr_size(
855 864
856 xfs_ilock(ip, XFS_ILOCK_EXCL); 865 xfs_ilock(ip, XFS_ILOCK_EXCL);
857 866
858 xfs_trans_ijoin(tp, ip); 867 xfs_trans_ijoin(tp, ip, 0);
859 868
860 /* 869 /*
861 * Only change the c/mtime if we are changing the size or we are 870 * Only change the c/mtime if we are changing the size or we are
@@ -1144,7 +1153,7 @@ xfs_setup_inode(
1144 hlist_add_fake(&inode->i_hash); 1153 hlist_add_fake(&inode->i_hash);
1145 1154
1146 inode->i_mode = ip->i_d.di_mode; 1155 inode->i_mode = ip->i_d.di_mode;
1147 inode->i_nlink = ip->i_d.di_nlink; 1156 set_nlink(inode, ip->i_d.di_nlink);
1148 inode->i_uid = ip->i_d.di_uid; 1157 inode->i_uid = ip->i_d.di_uid;
1149 inode->i_gid = ip->i_d.di_gid; 1158 inode->i_gid = ip->i_d.di_gid;
1150 1159