diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 172 |
1 files changed, 73 insertions, 99 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index ed399523b782..b792a121b1a7 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -75,19 +75,16 @@ xfs_open( | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | /* | ||
79 | * xfs_setattr | ||
80 | */ | ||
81 | int | 78 | int |
82 | xfs_setattr( | 79 | xfs_setattr( |
83 | xfs_inode_t *ip, | 80 | struct xfs_inode *ip, |
84 | bhv_vattr_t *vap, | 81 | struct iattr *iattr, |
85 | int flags, | 82 | int flags, |
86 | cred_t *credp) | 83 | cred_t *credp) |
87 | { | 84 | { |
88 | xfs_mount_t *mp = ip->i_mount; | 85 | xfs_mount_t *mp = ip->i_mount; |
86 | int mask = iattr->ia_valid; | ||
89 | xfs_trans_t *tp; | 87 | xfs_trans_t *tp; |
90 | int mask; | ||
91 | int code; | 88 | int code; |
92 | uint lock_flags; | 89 | uint lock_flags; |
93 | uint commit_flags=0; | 90 | uint commit_flags=0; |
@@ -103,30 +100,9 @@ xfs_setattr( | |||
103 | if (mp->m_flags & XFS_MOUNT_RDONLY) | 100 | if (mp->m_flags & XFS_MOUNT_RDONLY) |
104 | return XFS_ERROR(EROFS); | 101 | return XFS_ERROR(EROFS); |
105 | 102 | ||
106 | /* | ||
107 | * Cannot set certain attributes. | ||
108 | */ | ||
109 | mask = vap->va_mask; | ||
110 | if (mask & XFS_AT_NOSET) { | ||
111 | return XFS_ERROR(EINVAL); | ||
112 | } | ||
113 | |||
114 | if (XFS_FORCED_SHUTDOWN(mp)) | 103 | if (XFS_FORCED_SHUTDOWN(mp)) |
115 | return XFS_ERROR(EIO); | 104 | return XFS_ERROR(EIO); |
116 | 105 | ||
117 | /* | ||
118 | * Timestamps do not need to be logged and hence do not | ||
119 | * need to be done within a transaction. | ||
120 | */ | ||
121 | if (mask & XFS_AT_UPDTIMES) { | ||
122 | ASSERT((mask & ~XFS_AT_UPDTIMES) == 0); | ||
123 | timeflags = ((mask & XFS_AT_UPDATIME) ? XFS_ICHGTIME_ACC : 0) | | ||
124 | ((mask & XFS_AT_UPDCTIME) ? XFS_ICHGTIME_CHG : 0) | | ||
125 | ((mask & XFS_AT_UPDMTIME) ? XFS_ICHGTIME_MOD : 0); | ||
126 | xfs_ichgtime(ip, timeflags); | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | olddquot1 = olddquot2 = NULL; | 106 | olddquot1 = olddquot2 = NULL; |
131 | udqp = gdqp = NULL; | 107 | udqp = gdqp = NULL; |
132 | 108 | ||
@@ -138,17 +114,17 @@ xfs_setattr( | |||
138 | * If the IDs do change before we take the ilock, we're covered | 114 | * If the IDs do change before we take the ilock, we're covered |
139 | * because the i_*dquot fields will get updated anyway. | 115 | * because the i_*dquot fields will get updated anyway. |
140 | */ | 116 | */ |
141 | if (XFS_IS_QUOTA_ON(mp) && (mask & (XFS_AT_UID|XFS_AT_GID))) { | 117 | if (XFS_IS_QUOTA_ON(mp) && (mask & (ATTR_UID|ATTR_GID))) { |
142 | uint qflags = 0; | 118 | uint qflags = 0; |
143 | 119 | ||
144 | if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) { | 120 | if ((mask & ATTR_UID) && XFS_IS_UQUOTA_ON(mp)) { |
145 | uid = vap->va_uid; | 121 | uid = iattr->ia_uid; |
146 | qflags |= XFS_QMOPT_UQUOTA; | 122 | qflags |= XFS_QMOPT_UQUOTA; |
147 | } else { | 123 | } else { |
148 | uid = ip->i_d.di_uid; | 124 | uid = ip->i_d.di_uid; |
149 | } | 125 | } |
150 | if ((mask & XFS_AT_GID) && XFS_IS_GQUOTA_ON(mp)) { | 126 | if ((mask & ATTR_GID) && XFS_IS_GQUOTA_ON(mp)) { |
151 | gid = vap->va_gid; | 127 | gid = iattr->ia_gid; |
152 | qflags |= XFS_QMOPT_GQUOTA; | 128 | qflags |= XFS_QMOPT_GQUOTA; |
153 | } else { | 129 | } else { |
154 | gid = ip->i_d.di_gid; | 130 | gid = ip->i_d.di_gid; |
@@ -173,10 +149,10 @@ xfs_setattr( | |||
173 | */ | 149 | */ |
174 | tp = NULL; | 150 | tp = NULL; |
175 | lock_flags = XFS_ILOCK_EXCL; | 151 | lock_flags = XFS_ILOCK_EXCL; |
176 | if (flags & ATTR_NOLOCK) | 152 | if (flags & XFS_ATTR_NOLOCK) |
177 | need_iolock = 0; | 153 | need_iolock = 0; |
178 | if (!(mask & XFS_AT_SIZE)) { | 154 | if (!(mask & ATTR_SIZE)) { |
179 | if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) || | 155 | if ((mask != (ATTR_CTIME|ATTR_ATIME|ATTR_MTIME)) || |
180 | (mp->m_flags & XFS_MOUNT_WSYNC)) { | 156 | (mp->m_flags & XFS_MOUNT_WSYNC)) { |
181 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); | 157 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); |
182 | commit_flags = 0; | 158 | commit_flags = 0; |
@@ -189,10 +165,10 @@ xfs_setattr( | |||
189 | } | 165 | } |
190 | } else { | 166 | } else { |
191 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && | 167 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && |
192 | !(flags & ATTR_DMI)) { | 168 | !(flags & XFS_ATTR_DMI)) { |
193 | int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR; | 169 | int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR; |
194 | code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, ip, | 170 | code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, ip, |
195 | vap->va_size, 0, dmflags, NULL); | 171 | iattr->ia_size, 0, dmflags, NULL); |
196 | if (code) { | 172 | if (code) { |
197 | lock_flags = 0; | 173 | lock_flags = 0; |
198 | goto error_return; | 174 | goto error_return; |
@@ -212,7 +188,7 @@ xfs_setattr( | |||
212 | * Only the owner or users with CAP_FOWNER | 188 | * Only the owner or users with CAP_FOWNER |
213 | * capability may do these things. | 189 | * capability may do these things. |
214 | */ | 190 | */ |
215 | if (mask & (XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID)) { | 191 | if (mask & (ATTR_MODE|ATTR_UID|ATTR_GID)) { |
216 | /* | 192 | /* |
217 | * CAP_FOWNER overrides the following restrictions: | 193 | * CAP_FOWNER overrides the following restrictions: |
218 | * | 194 | * |
@@ -236,21 +212,21 @@ xfs_setattr( | |||
236 | * IDs of the calling process shall match the group owner of | 212 | * IDs of the calling process shall match the group owner of |
237 | * the file when setting the set-group-ID bit on that file | 213 | * the file when setting the set-group-ID bit on that file |
238 | */ | 214 | */ |
239 | if (mask & XFS_AT_MODE) { | 215 | if (mask & ATTR_MODE) { |
240 | mode_t m = 0; | 216 | mode_t m = 0; |
241 | 217 | ||
242 | if ((vap->va_mode & S_ISUID) && !file_owner) | 218 | if ((iattr->ia_mode & S_ISUID) && !file_owner) |
243 | m |= S_ISUID; | 219 | m |= S_ISUID; |
244 | if ((vap->va_mode & S_ISGID) && | 220 | if ((iattr->ia_mode & S_ISGID) && |
245 | !in_group_p((gid_t)ip->i_d.di_gid)) | 221 | !in_group_p((gid_t)ip->i_d.di_gid)) |
246 | m |= S_ISGID; | 222 | m |= S_ISGID; |
247 | #if 0 | 223 | #if 0 |
248 | /* Linux allows this, Irix doesn't. */ | 224 | /* Linux allows this, Irix doesn't. */ |
249 | if ((vap->va_mode & S_ISVTX) && !S_ISDIR(ip->i_d.di_mode)) | 225 | if ((iattr->ia_mode & S_ISVTX) && !S_ISDIR(ip->i_d.di_mode)) |
250 | m |= S_ISVTX; | 226 | m |= S_ISVTX; |
251 | #endif | 227 | #endif |
252 | if (m && !capable(CAP_FSETID)) | 228 | if (m && !capable(CAP_FSETID)) |
253 | vap->va_mode &= ~m; | 229 | iattr->ia_mode &= ~m; |
254 | } | 230 | } |
255 | } | 231 | } |
256 | 232 | ||
@@ -261,7 +237,7 @@ xfs_setattr( | |||
261 | * and can change the group id only to a group of which he | 237 | * and can change the group id only to a group of which he |
262 | * or she is a member. | 238 | * or she is a member. |
263 | */ | 239 | */ |
264 | if (mask & (XFS_AT_UID|XFS_AT_GID)) { | 240 | if (mask & (ATTR_UID|ATTR_GID)) { |
265 | /* | 241 | /* |
266 | * These IDs could have changed since we last looked at them. | 242 | * These IDs could have changed since we last looked at them. |
267 | * But, we're assured that if the ownership did change | 243 | * But, we're assured that if the ownership did change |
@@ -270,8 +246,8 @@ xfs_setattr( | |||
270 | */ | 246 | */ |
271 | iuid = ip->i_d.di_uid; | 247 | iuid = ip->i_d.di_uid; |
272 | igid = ip->i_d.di_gid; | 248 | igid = ip->i_d.di_gid; |
273 | gid = (mask & XFS_AT_GID) ? vap->va_gid : igid; | 249 | gid = (mask & ATTR_GID) ? iattr->ia_gid : igid; |
274 | uid = (mask & XFS_AT_UID) ? vap->va_uid : iuid; | 250 | uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid; |
275 | 251 | ||
276 | /* | 252 | /* |
277 | * CAP_CHOWN overrides the following restrictions: | 253 | * CAP_CHOWN overrides the following restrictions: |
@@ -308,13 +284,13 @@ xfs_setattr( | |||
308 | /* | 284 | /* |
309 | * Truncate file. Must have write permission and not be a directory. | 285 | * Truncate file. Must have write permission and not be a directory. |
310 | */ | 286 | */ |
311 | if (mask & XFS_AT_SIZE) { | 287 | if (mask & ATTR_SIZE) { |
312 | /* Short circuit the truncate case for zero length files */ | 288 | /* Short circuit the truncate case for zero length files */ |
313 | if ((vap->va_size == 0) && | 289 | if (iattr->ia_size == 0 && |
314 | (ip->i_size == 0) && (ip->i_d.di_nextents == 0)) { | 290 | ip->i_size == 0 && ip->i_d.di_nextents == 0) { |
315 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 291 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
316 | lock_flags &= ~XFS_ILOCK_EXCL; | 292 | lock_flags &= ~XFS_ILOCK_EXCL; |
317 | if (mask & XFS_AT_CTIME) | 293 | if (mask & ATTR_CTIME) |
318 | xfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 294 | xfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
319 | code = 0; | 295 | code = 0; |
320 | goto error_return; | 296 | goto error_return; |
@@ -337,9 +313,9 @@ xfs_setattr( | |||
337 | /* | 313 | /* |
338 | * Change file access or modified times. | 314 | * Change file access or modified times. |
339 | */ | 315 | */ |
340 | if (mask & (XFS_AT_ATIME|XFS_AT_MTIME)) { | 316 | if (mask & (ATTR_ATIME|ATTR_MTIME)) { |
341 | if (!file_owner) { | 317 | if (!file_owner) { |
342 | if ((flags & ATTR_UTIME) && | 318 | if ((mask & (ATTR_MTIME_SET|ATTR_ATIME_SET)) && |
343 | !capable(CAP_FOWNER)) { | 319 | !capable(CAP_FOWNER)) { |
344 | code = XFS_ERROR(EPERM); | 320 | code = XFS_ERROR(EPERM); |
345 | goto error_return; | 321 | goto error_return; |
@@ -349,23 +325,22 @@ xfs_setattr( | |||
349 | 325 | ||
350 | /* | 326 | /* |
351 | * Now we can make the changes. Before we join the inode | 327 | * Now we can make the changes. Before we join the inode |
352 | * to the transaction, if XFS_AT_SIZE is set then take care of | 328 | * to the transaction, if ATTR_SIZE is set then take care of |
353 | * the part of the truncation that must be done without the | 329 | * the part of the truncation that must be done without the |
354 | * inode lock. This needs to be done before joining the inode | 330 | * inode lock. This needs to be done before joining the inode |
355 | * to the transaction, because the inode cannot be unlocked | 331 | * to the transaction, because the inode cannot be unlocked |
356 | * once it is a part of the transaction. | 332 | * once it is a part of the transaction. |
357 | */ | 333 | */ |
358 | if (mask & XFS_AT_SIZE) { | 334 | if (mask & ATTR_SIZE) { |
359 | code = 0; | 335 | code = 0; |
360 | if ((vap->va_size > ip->i_size) && | 336 | if (iattr->ia_size > ip->i_size) { |
361 | (flags & ATTR_NOSIZETOK) == 0) { | ||
362 | /* | 337 | /* |
363 | * Do the first part of growing a file: zero any data | 338 | * Do the first part of growing a file: zero any data |
364 | * in the last block that is beyond the old EOF. We | 339 | * in the last block that is beyond the old EOF. We |
365 | * need to do this before the inode is joined to the | 340 | * need to do this before the inode is joined to the |
366 | * transaction to modify the i_size. | 341 | * transaction to modify the i_size. |
367 | */ | 342 | */ |
368 | code = xfs_zero_eof(ip, vap->va_size, ip->i_size); | 343 | code = xfs_zero_eof(ip, iattr->ia_size, ip->i_size); |
369 | } | 344 | } |
370 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 345 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
371 | 346 | ||
@@ -382,10 +357,10 @@ xfs_setattr( | |||
382 | * not within the range we care about here. | 357 | * not within the range we care about here. |
383 | */ | 358 | */ |
384 | if (!code && | 359 | if (!code && |
385 | (ip->i_size != ip->i_d.di_size) && | 360 | ip->i_size != ip->i_d.di_size && |
386 | (vap->va_size > ip->i_d.di_size)) { | 361 | iattr->ia_size > ip->i_d.di_size) { |
387 | code = xfs_flush_pages(ip, | 362 | code = xfs_flush_pages(ip, |
388 | ip->i_d.di_size, vap->va_size, | 363 | ip->i_d.di_size, iattr->ia_size, |
389 | XFS_B_ASYNC, FI_NONE); | 364 | XFS_B_ASYNC, FI_NONE); |
390 | } | 365 | } |
391 | 366 | ||
@@ -393,7 +368,7 @@ xfs_setattr( | |||
393 | vn_iowait(ip); | 368 | vn_iowait(ip); |
394 | 369 | ||
395 | if (!code) | 370 | if (!code) |
396 | code = xfs_itruncate_data(ip, vap->va_size); | 371 | code = xfs_itruncate_data(ip, iattr->ia_size); |
397 | if (code) { | 372 | if (code) { |
398 | ASSERT(tp == NULL); | 373 | ASSERT(tp == NULL); |
399 | lock_flags &= ~XFS_ILOCK_EXCL; | 374 | lock_flags &= ~XFS_ILOCK_EXCL; |
@@ -422,31 +397,30 @@ xfs_setattr( | |||
422 | /* | 397 | /* |
423 | * Truncate file. Must have write permission and not be a directory. | 398 | * Truncate file. Must have write permission and not be a directory. |
424 | */ | 399 | */ |
425 | if (mask & XFS_AT_SIZE) { | 400 | if (mask & ATTR_SIZE) { |
426 | /* | 401 | /* |
427 | * Only change the c/mtime if we are changing the size | 402 | * Only change the c/mtime if we are changing the size |
428 | * or we are explicitly asked to change it. This handles | 403 | * or we are explicitly asked to change it. This handles |
429 | * the semantic difference between truncate() and ftruncate() | 404 | * the semantic difference between truncate() and ftruncate() |
430 | * as implemented in the VFS. | 405 | * as implemented in the VFS. |
431 | */ | 406 | */ |
432 | if (vap->va_size != ip->i_size || (mask & XFS_AT_CTIME)) | 407 | if (iattr->ia_size != ip->i_size || (mask & ATTR_CTIME)) |
433 | timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; | 408 | timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; |
434 | 409 | ||
435 | if (vap->va_size > ip->i_size) { | 410 | if (iattr->ia_size > ip->i_size) { |
436 | ip->i_d.di_size = vap->va_size; | 411 | ip->i_d.di_size = iattr->ia_size; |
437 | ip->i_size = vap->va_size; | 412 | ip->i_size = iattr->ia_size; |
438 | if (!(flags & ATTR_DMI)) | 413 | if (!(flags & XFS_ATTR_DMI)) |
439 | xfs_ichgtime(ip, XFS_ICHGTIME_CHG); | 414 | xfs_ichgtime(ip, XFS_ICHGTIME_CHG); |
440 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 415 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
441 | } else if ((vap->va_size <= ip->i_size) || | 416 | } else if (iattr->ia_size <= ip->i_size || |
442 | ((vap->va_size == 0) && ip->i_d.di_nextents)) { | 417 | (iattr->ia_size == 0 && ip->i_d.di_nextents)) { |
443 | /* | 418 | /* |
444 | * signal a sync transaction unless | 419 | * signal a sync transaction unless |
445 | * we're truncating an already unlinked | 420 | * we're truncating an already unlinked |
446 | * file on a wsync filesystem | 421 | * file on a wsync filesystem |
447 | */ | 422 | */ |
448 | code = xfs_itruncate_finish(&tp, ip, | 423 | code = xfs_itruncate_finish(&tp, ip, iattr->ia_size, |
449 | (xfs_fsize_t)vap->va_size, | ||
450 | XFS_DATA_FORK, | 424 | XFS_DATA_FORK, |
451 | ((ip->i_d.di_nlink != 0 || | 425 | ((ip->i_d.di_nlink != 0 || |
452 | !(mp->m_flags & XFS_MOUNT_WSYNC)) | 426 | !(mp->m_flags & XFS_MOUNT_WSYNC)) |
@@ -468,9 +442,9 @@ xfs_setattr( | |||
468 | /* | 442 | /* |
469 | * Change file access modes. | 443 | * Change file access modes. |
470 | */ | 444 | */ |
471 | if (mask & XFS_AT_MODE) { | 445 | if (mask & ATTR_MODE) { |
472 | ip->i_d.di_mode &= S_IFMT; | 446 | ip->i_d.di_mode &= S_IFMT; |
473 | ip->i_d.di_mode |= vap->va_mode & ~S_IFMT; | 447 | ip->i_d.di_mode |= iattr->ia_mode & ~S_IFMT; |
474 | 448 | ||
475 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); | 449 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); |
476 | timeflags |= XFS_ICHGTIME_CHG; | 450 | timeflags |= XFS_ICHGTIME_CHG; |
@@ -483,7 +457,7 @@ xfs_setattr( | |||
483 | * and can change the group id only to a group of which he | 457 | * and can change the group id only to a group of which he |
484 | * or she is a member. | 458 | * or she is a member. |
485 | */ | 459 | */ |
486 | if (mask & (XFS_AT_UID|XFS_AT_GID)) { | 460 | if (mask & (ATTR_UID|ATTR_GID)) { |
487 | /* | 461 | /* |
488 | * CAP_FSETID overrides the following restrictions: | 462 | * CAP_FSETID overrides the following restrictions: |
489 | * | 463 | * |
@@ -501,7 +475,7 @@ xfs_setattr( | |||
501 | */ | 475 | */ |
502 | if (iuid != uid) { | 476 | if (iuid != uid) { |
503 | if (XFS_IS_UQUOTA_ON(mp)) { | 477 | if (XFS_IS_UQUOTA_ON(mp)) { |
504 | ASSERT(mask & XFS_AT_UID); | 478 | ASSERT(mask & ATTR_UID); |
505 | ASSERT(udqp); | 479 | ASSERT(udqp); |
506 | olddquot1 = XFS_QM_DQVOPCHOWN(mp, tp, ip, | 480 | olddquot1 = XFS_QM_DQVOPCHOWN(mp, tp, ip, |
507 | &ip->i_udquot, udqp); | 481 | &ip->i_udquot, udqp); |
@@ -511,7 +485,7 @@ xfs_setattr( | |||
511 | if (igid != gid) { | 485 | if (igid != gid) { |
512 | if (XFS_IS_GQUOTA_ON(mp)) { | 486 | if (XFS_IS_GQUOTA_ON(mp)) { |
513 | ASSERT(!XFS_IS_PQUOTA_ON(mp)); | 487 | ASSERT(!XFS_IS_PQUOTA_ON(mp)); |
514 | ASSERT(mask & XFS_AT_GID); | 488 | ASSERT(mask & ATTR_GID); |
515 | ASSERT(gdqp); | 489 | ASSERT(gdqp); |
516 | olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip, | 490 | olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip, |
517 | &ip->i_gdquot, gdqp); | 491 | &ip->i_gdquot, gdqp); |
@@ -527,31 +501,31 @@ xfs_setattr( | |||
527 | /* | 501 | /* |
528 | * Change file access or modified times. | 502 | * Change file access or modified times. |
529 | */ | 503 | */ |
530 | if (mask & (XFS_AT_ATIME|XFS_AT_MTIME)) { | 504 | if (mask & (ATTR_ATIME|ATTR_MTIME)) { |
531 | if (mask & XFS_AT_ATIME) { | 505 | if (mask & ATTR_ATIME) { |
532 | ip->i_d.di_atime.t_sec = vap->va_atime.tv_sec; | 506 | ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; |
533 | ip->i_d.di_atime.t_nsec = vap->va_atime.tv_nsec; | 507 | ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; |
534 | ip->i_update_core = 1; | 508 | ip->i_update_core = 1; |
535 | timeflags &= ~XFS_ICHGTIME_ACC; | 509 | timeflags &= ~XFS_ICHGTIME_ACC; |
536 | } | 510 | } |
537 | if (mask & XFS_AT_MTIME) { | 511 | if (mask & ATTR_MTIME) { |
538 | ip->i_d.di_mtime.t_sec = vap->va_mtime.tv_sec; | 512 | ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec; |
539 | ip->i_d.di_mtime.t_nsec = vap->va_mtime.tv_nsec; | 513 | ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec; |
540 | timeflags &= ~XFS_ICHGTIME_MOD; | 514 | timeflags &= ~XFS_ICHGTIME_MOD; |
541 | timeflags |= XFS_ICHGTIME_CHG; | 515 | timeflags |= XFS_ICHGTIME_CHG; |
542 | } | 516 | } |
543 | if (tp && (flags & ATTR_UTIME)) | 517 | if (tp && (mask & (ATTR_MTIME_SET|ATTR_ATIME_SET))) |
544 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); | 518 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); |
545 | } | 519 | } |
546 | 520 | ||
547 | /* | 521 | /* |
548 | * Change file inode change time only if XFS_AT_CTIME set | 522 | * Change file inode change time only if ATTR_CTIME set |
549 | * AND we have been called by a DMI function. | 523 | * AND we have been called by a DMI function. |
550 | */ | 524 | */ |
551 | 525 | ||
552 | if ( (flags & ATTR_DMI) && (mask & XFS_AT_CTIME) ) { | 526 | if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) { |
553 | ip->i_d.di_ctime.t_sec = vap->va_ctime.tv_sec; | 527 | ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; |
554 | ip->i_d.di_ctime.t_nsec = vap->va_ctime.tv_nsec; | 528 | ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; |
555 | ip->i_update_core = 1; | 529 | ip->i_update_core = 1; |
556 | timeflags &= ~XFS_ICHGTIME_CHG; | 530 | timeflags &= ~XFS_ICHGTIME_CHG; |
557 | } | 531 | } |
@@ -560,7 +534,7 @@ xfs_setattr( | |||
560 | * Send out timestamp changes that need to be set to the | 534 | * Send out timestamp changes that need to be set to the |
561 | * current time. Not done when called by a DMI function. | 535 | * current time. Not done when called by a DMI function. |
562 | */ | 536 | */ |
563 | if (timeflags && !(flags & ATTR_DMI)) | 537 | if (timeflags && !(flags & XFS_ATTR_DMI)) |
564 | xfs_ichgtime(ip, timeflags); | 538 | xfs_ichgtime(ip, timeflags); |
565 | 539 | ||
566 | XFS_STATS_INC(xs_ig_attrchg); | 540 | XFS_STATS_INC(xs_ig_attrchg); |
@@ -598,7 +572,7 @@ xfs_setattr( | |||
598 | } | 572 | } |
599 | 573 | ||
600 | if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) && | 574 | if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) && |
601 | !(flags & ATTR_DMI)) { | 575 | !(flags & XFS_ATTR_DMI)) { |
602 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, ip, DM_RIGHT_NULL, | 576 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, ip, DM_RIGHT_NULL, |
603 | NULL, DM_RIGHT_NULL, NULL, NULL, | 577 | NULL, DM_RIGHT_NULL, NULL, NULL, |
604 | 0, 0, AT_DELAY_FLAG(flags)); | 578 | 0, 0, AT_DELAY_FLAG(flags)); |
@@ -3113,7 +3087,7 @@ xfs_alloc_file_space( | |||
3113 | 3087 | ||
3114 | /* Generate a DMAPI event if needed. */ | 3088 | /* Generate a DMAPI event if needed. */ |
3115 | if (alloc_type != 0 && offset < ip->i_size && | 3089 | if (alloc_type != 0 && offset < ip->i_size && |
3116 | (attr_flags&ATTR_DMI) == 0 && | 3090 | (attr_flags & XFS_ATTR_DMI) == 0 && |
3117 | DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) { | 3091 | DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) { |
3118 | xfs_off_t end_dmi_offset; | 3092 | xfs_off_t end_dmi_offset; |
3119 | 3093 | ||
@@ -3227,7 +3201,7 @@ retry: | |||
3227 | allocatesize_fsb -= allocated_fsb; | 3201 | allocatesize_fsb -= allocated_fsb; |
3228 | } | 3202 | } |
3229 | dmapi_enospc_check: | 3203 | dmapi_enospc_check: |
3230 | if (error == ENOSPC && (attr_flags & ATTR_DMI) == 0 && | 3204 | if (error == ENOSPC && (attr_flags & XFS_ATTR_DMI) == 0 && |
3231 | DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) { | 3205 | DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) { |
3232 | error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE, | 3206 | error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE, |
3233 | ip, DM_RIGHT_NULL, | 3207 | ip, DM_RIGHT_NULL, |
@@ -3374,7 +3348,7 @@ xfs_free_file_space( | |||
3374 | end_dmi_offset = offset + len; | 3348 | end_dmi_offset = offset + len; |
3375 | endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); | 3349 | endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); |
3376 | 3350 | ||
3377 | if (offset < ip->i_size && (attr_flags & ATTR_DMI) == 0 && | 3351 | if (offset < ip->i_size && (attr_flags & XFS_ATTR_DMI) == 0 && |
3378 | DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) { | 3352 | DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) { |
3379 | if (end_dmi_offset > ip->i_size) | 3353 | if (end_dmi_offset > ip->i_size) |
3380 | end_dmi_offset = ip->i_size; | 3354 | end_dmi_offset = ip->i_size; |
@@ -3385,7 +3359,7 @@ xfs_free_file_space( | |||
3385 | return error; | 3359 | return error; |
3386 | } | 3360 | } |
3387 | 3361 | ||
3388 | if (attr_flags & ATTR_NOLOCK) | 3362 | if (attr_flags & XFS_ATTR_NOLOCK) |
3389 | need_iolock = 0; | 3363 | need_iolock = 0; |
3390 | if (need_iolock) { | 3364 | if (need_iolock) { |
3391 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 3365 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
@@ -3562,7 +3536,7 @@ xfs_change_file_space( | |||
3562 | xfs_off_t startoffset; | 3536 | xfs_off_t startoffset; |
3563 | xfs_off_t llen; | 3537 | xfs_off_t llen; |
3564 | xfs_trans_t *tp; | 3538 | xfs_trans_t *tp; |
3565 | bhv_vattr_t va; | 3539 | struct iattr iattr; |
3566 | 3540 | ||
3567 | xfs_itrace_entry(ip); | 3541 | xfs_itrace_entry(ip); |
3568 | 3542 | ||
@@ -3636,10 +3610,10 @@ xfs_change_file_space( | |||
3636 | break; | 3610 | break; |
3637 | } | 3611 | } |
3638 | 3612 | ||
3639 | va.va_mask = XFS_AT_SIZE; | 3613 | iattr.ia_valid = ATTR_SIZE; |
3640 | va.va_size = startoffset; | 3614 | iattr.ia_size = startoffset; |
3641 | 3615 | ||
3642 | error = xfs_setattr(ip, &va, attr_flags, credp); | 3616 | error = xfs_setattr(ip, &iattr, attr_flags, credp); |
3643 | 3617 | ||
3644 | if (error) | 3618 | if (error) |
3645 | return error; | 3619 | return error; |
@@ -3669,7 +3643,7 @@ xfs_change_file_space( | |||
3669 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 3643 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
3670 | xfs_trans_ihold(tp, ip); | 3644 | xfs_trans_ihold(tp, ip); |
3671 | 3645 | ||
3672 | if ((attr_flags & ATTR_DMI) == 0) { | 3646 | if ((attr_flags & XFS_ATTR_DMI) == 0) { |
3673 | ip->i_d.di_mode &= ~S_ISUID; | 3647 | ip->i_d.di_mode &= ~S_ISUID; |
3674 | 3648 | ||
3675 | /* | 3649 | /* |