1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright (c) 2011, Lawrence Livermore National Security, LLC. 23 * Copyright (c) 2015 by Chunwei Chen. All rights reserved. 24 */ 25 26 27 #include <sys/zfs_ctldir.h> 28 #include <sys/zfs_vfsops.h> 29 #include <sys/zfs_vnops.h> 30 #include <sys/zfs_znode.h> 31 #include <sys/dmu_objset.h> 32 #include <sys/vfs.h> 33 #include <sys/zpl.h> 34 #include <sys/file.h> 35 36 37 static struct dentry * 38 zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) 39 { 40 cred_t *cr = CRED(); 41 struct inode *ip; 42 znode_t *zp; 43 int error; 44 fstrans_cookie_t cookie; 45 pathname_t *ppn = NULL; 46 pathname_t pn; 47 int zfs_flags = 0; 48 zfsvfs_t *zfsvfs = dentry->d_sb->s_fs_info; 49 50 if (dlen(dentry) >= ZAP_MAXNAMELEN) 51 return (ERR_PTR(-ENAMETOOLONG)); 52 53 crhold(cr); 54 cookie = spl_fstrans_mark(); 55 56 /* If we are a case insensitive fs, we need the real name */ 57 if (zfsvfs->z_case == ZFS_CASE_INSENSITIVE) { 58 zfs_flags = FIGNORECASE; 59 pn_alloc(&pn); 60 ppn = &pn; 61 } 62 63 error = -zfs_lookup(ITOZ(dir), dname(dentry), &zp, 64 zfs_flags, cr, NULL, ppn); 65 spl_fstrans_unmark(cookie); 66 ASSERT3S(error, <=, 0); 67 crfree(cr); 68 69 spin_lock(&dentry->d_lock); 70 dentry->d_time = jiffies; 71 spin_unlock(&dentry->d_lock); 72 73 if (error) { 74 /* 75 * If we have a case sensitive fs, we do not want to 76 * insert negative entries, so return NULL for ENOENT. 77 * Fall through if the error is not ENOENT. Also free memory. 78 */ 79 if (ppn) { 80 pn_free(ppn); 81 if (error == -ENOENT) 82 return (NULL); 83 } 84 85 if (error == -ENOENT) 86 return (d_splice_alias(NULL, dentry)); 87 else 88 return (ERR_PTR(error)); 89 } 90 ip = ZTOI(zp); 91 92 /* 93 * If we are case insensitive, call the correct function 94 * to install the name. 95 */ 96 if (ppn) { 97 struct dentry *new_dentry; 98 struct qstr ci_name; 99 100 if (strcmp(dname(dentry), pn.pn_buf) == 0) { 101 new_dentry = d_splice_alias(ip, dentry); 102 } else { 103 ci_name.name = pn.pn_buf; 104 ci_name.len = strlen(pn.pn_buf); 105 new_dentry = d_add_ci(dentry, ip, &ci_name); 106 } 107 pn_free(ppn); 108 return (new_dentry); 109 } else { 110 return (d_splice_alias(ip, dentry)); 111 } 112 } 113 114 void 115 zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr) 116 { 117 vap->va_mask = ATTR_MODE; 118 vap->va_mode = mode; 119 vap->va_uid = crgetfsuid(cr); 120 121 if (dir && dir->i_mode & S_ISGID) { 122 vap->va_gid = KGID_TO_SGID(dir->i_gid); 123 if (S_ISDIR(mode)) 124 vap->va_mode |= S_ISGID; 125 } else { 126 vap->va_gid = crgetfsgid(cr); 127 } 128 } 129 130 static int 131 zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag) 132 { 133 cred_t *cr = CRED(); 134 znode_t *zp; 135 vattr_t *vap; 136 int error; 137 fstrans_cookie_t cookie; 138 139 crhold(cr); 140 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP); 141 zpl_vap_init(vap, dir, mode, cr); 142 143 cookie = spl_fstrans_mark(); 144 error = -zfs_create(ITOZ(dir), dname(dentry), vap, 0, 145 mode, &zp, cr, 0, NULL); 146 if (error == 0) { 147 d_instantiate(dentry, ZTOI(zp)); 148 149 error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name); 150 if (error == 0) 151 error = zpl_init_acl(ZTOI(zp), dir); 152 153 if (error) 154 (void) zfs_remove(ITOZ(dir), dname(dentry), cr, 0); 155 } 156 157 spl_fstrans_unmark(cookie); 158 kmem_free(vap, sizeof (vattr_t)); 159 crfree(cr); 160 ASSERT3S(error, <=, 0); 161 162 return (error); 163 } 164 165 static int 166 zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, 167 dev_t rdev) 168 { 169 cred_t *cr = CRED(); 170 znode_t *zp; 171 vattr_t *vap; 172 int error; 173 fstrans_cookie_t cookie; 174 175 /* 176 * We currently expect Linux to supply rdev=0 for all sockets 177 * and fifos, but we want to know if this behavior ever changes. 178 */ 179 if (S_ISSOCK(mode) || S_ISFIFO(mode)) 180 ASSERT(rdev == 0); 181 182 crhold(cr); 183 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP); 184 zpl_vap_init(vap, dir, mode, cr); 185 vap->va_rdev = rdev; 186 187 cookie = spl_fstrans_mark(); 188 error = -zfs_create(ITOZ(dir), dname(dentry), vap, 0, 189 mode, &zp, cr, 0, NULL); 190 if (error == 0) { 191 d_instantiate(dentry, ZTOI(zp)); 192 193 error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name); 194 if (error == 0) 195 error = zpl_init_acl(ZTOI(zp), dir); 196 197 if (error) 198 (void) zfs_remove(ITOZ(dir), dname(dentry), cr, 0); 199 } 200 201 spl_fstrans_unmark(cookie); 202 kmem_free(vap, sizeof (vattr_t)); 203 crfree(cr); 204 ASSERT3S(error, <=, 0); 205 206 return (error); 207 } 208 209 #ifdef HAVE_TMPFILE 210 static int 211 zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) 212 { 213 cred_t *cr = CRED(); 214 struct inode *ip; 215 vattr_t *vap; 216 int error; 217 fstrans_cookie_t cookie; 218 219 crhold(cr); 220 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP); 221 /* 222 * The VFS does not apply the umask, therefore it is applied here 223 * when POSIX ACLs are not enabled. 224 */ 225 if (!IS_POSIXACL(dir)) 226 mode &= ~current_umask(); 227 zpl_vap_init(vap, dir, mode, cr); 228 229 cookie = spl_fstrans_mark(); 230 error = -zfs_tmpfile(dir, vap, 0, mode, &ip, cr, 0, NULL); 231 if (error == 0) { 232 /* d_tmpfile will do drop_nlink, so we should set it first */ 233 set_nlink(ip, 1); 234 d_tmpfile(dentry, ip); 235 236 error = zpl_xattr_security_init(ip, dir, &dentry->d_name); 237 if (error == 0) 238 error = zpl_init_acl(ip, dir); 239 /* 240 * don't need to handle error here, file is already in 241 * unlinked set. 242 */ 243 } 244 245 spl_fstrans_unmark(cookie); 246 kmem_free(vap, sizeof (vattr_t)); 247 crfree(cr); 248 ASSERT3S(error, <=, 0); 249 250 return (error); 251 } 252 #endif 253 254 static int 255 zpl_unlink(struct inode *dir, struct dentry *dentry) 256 { 257 cred_t *cr = CRED(); 258 int error; 259 fstrans_cookie_t cookie; 260 zfsvfs_t *zfsvfs = dentry->d_sb->s_fs_info; 261 262 crhold(cr); 263 cookie = spl_fstrans_mark(); 264 error = -zfs_remove(ITOZ(dir), dname(dentry), cr, 0); 265 266 /* 267 * For a CI FS we must invalidate the dentry to prevent the 268 * creation of negative entries. 269 */ 270 if (error == 0 && zfsvfs->z_case == ZFS_CASE_INSENSITIVE) 271 d_invalidate(dentry); 272 273 spl_fstrans_unmark(cookie); 274 crfree(cr); 275 ASSERT3S(error, <=, 0); 276 277 return (error); 278 } 279 280 static int 281 zpl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 282 { 283 cred_t *cr = CRED(); 284 vattr_t *vap; 285 znode_t *zp; 286 int error; 287 fstrans_cookie_t cookie; 288 289 crhold(cr); 290 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP); 291 zpl_vap_init(vap, dir, mode | S_IFDIR, cr); 292 293 cookie = spl_fstrans_mark(); 294 error = -zfs_mkdir(ITOZ(dir), dname(dentry), vap, &zp, cr, 0, NULL); 295 if (error == 0) { 296 d_instantiate(dentry, ZTOI(zp)); 297 298 error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name); 299 if (error == 0) 300 error = zpl_init_acl(ZTOI(zp), dir); 301 302 if (error) 303 (void) zfs_rmdir(ITOZ(dir), dname(dentry), NULL, cr, 0); 304 } 305 306 spl_fstrans_unmark(cookie); 307 kmem_free(vap, sizeof (vattr_t)); 308 crfree(cr); 309 ASSERT3S(error, <=, 0); 310 311 return (error); 312 } 313 314 static int 315 zpl_rmdir(struct inode *dir, struct dentry *dentry) 316 { 317 cred_t *cr = CRED(); 318 int error; 319 fstrans_cookie_t cookie; 320 zfsvfs_t *zfsvfs = dentry->d_sb->s_fs_info; 321 322 crhold(cr); 323 cookie = spl_fstrans_mark(); 324 error = -zfs_rmdir(ITOZ(dir), dname(dentry), NULL, cr, 0); 325 326 /* 327 * For a CI FS we must invalidate the dentry to prevent the 328 * creation of negative entries. 329 */ 330 if (error == 0 && zfsvfs->z_case == ZFS_CASE_INSENSITIVE) 331 d_invalidate(dentry); 332 333 spl_fstrans_unmark(cookie); 334 crfree(cr); 335 ASSERT3S(error, <=, 0); 336 337 return (error); 338 } 339 340 static int 341 zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask, 342 unsigned int query_flags) 343 { 344 int error; 345 fstrans_cookie_t cookie; 346 347 cookie = spl_fstrans_mark(); 348 349 /* 350 * XXX request_mask and query_flags currently ignored. 351 */ 352 353 error = -zfs_getattr_fast(path->dentry->d_inode, stat); 354 spl_fstrans_unmark(cookie); 355 ASSERT3S(error, <=, 0); 356 357 return (error); 358 } 359 ZPL_GETATTR_WRAPPER(zpl_getattr); 360 361 static int 362 zpl_setattr(struct dentry *dentry, struct iattr *ia) 363 { 364 struct inode *ip = dentry->d_inode; 365 cred_t *cr = CRED(); 366 vattr_t *vap; 367 int error; 368 fstrans_cookie_t cookie; 369 370 error = setattr_prepare(dentry, ia); 371 if (error) 372 return (error); 373 374 crhold(cr); 375 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP); 376 vap->va_mask = ia->ia_valid & ATTR_IATTR_MASK; 377 vap->va_mode = ia->ia_mode; 378 vap->va_uid = KUID_TO_SUID(ia->ia_uid); 379 vap->va_gid = KGID_TO_SGID(ia->ia_gid); 380 vap->va_size = ia->ia_size; 381 vap->va_atime = ia->ia_atime; 382 vap->va_mtime = ia->ia_mtime; 383 vap->va_ctime = ia->ia_ctime; 384 385 if (vap->va_mask & ATTR_ATIME) 386 ip->i_atime = zpl_inode_timestamp_truncate(ia->ia_atime, ip); 387 388 cookie = spl_fstrans_mark(); 389 error = -zfs_setattr(ITOZ(ip), vap, 0, cr); 390 if (!error && (ia->ia_valid & ATTR_MODE)) 391 error = zpl_chmod_acl(ip); 392 393 spl_fstrans_unmark(cookie); 394 kmem_free(vap, sizeof (vattr_t)); 395 crfree(cr); 396 ASSERT3S(error, <=, 0); 397 398 return (error); 399 } 400 401 static int 402 zpl_rename2(struct inode *sdip, struct dentry *sdentry, 403 struct inode *tdip, struct dentry *tdentry, unsigned int flags) 404 { 405 cred_t *cr = CRED(); 406 int error; 407 fstrans_cookie_t cookie; 408 409 /* We don't have renameat2(2) support */ 410 if (flags) 411 return (-EINVAL); 412 413 crhold(cr); 414 cookie = spl_fstrans_mark(); 415 error = -zfs_rename(ITOZ(sdip), dname(sdentry), ITOZ(tdip), 416 dname(tdentry), cr, 0); 417 spl_fstrans_unmark(cookie); 418 crfree(cr); 419 ASSERT3S(error, <=, 0); 420 421 return (error); 422 } 423 424 #ifndef HAVE_RENAME_WANTS_FLAGS 425 static int 426 zpl_rename(struct inode *sdip, struct dentry *sdentry, 427 struct inode *tdip, struct dentry *tdentry) 428 { 429 return (zpl_rename2(sdip, sdentry, tdip, tdentry, 0)); 430 } 431 #endif 432 433 static int 434 zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name) 435 { 436 cred_t *cr = CRED(); 437 vattr_t *vap; 438 znode_t *zp; 439 int error; 440 fstrans_cookie_t cookie; 441 442 crhold(cr); 443 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP); 444 zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr); 445 446 cookie = spl_fstrans_mark(); 447 error = -zfs_symlink(ITOZ(dir), dname(dentry), vap, 448 (char *)name, &zp, cr, 0); 449 if (error == 0) { 450 d_instantiate(dentry, ZTOI(zp)); 451 452 error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name); 453 if (error) 454 (void) zfs_remove(ITOZ(dir), dname(dentry), cr, 0); 455 } 456 457 spl_fstrans_unmark(cookie); 458 kmem_free(vap, sizeof (vattr_t)); 459 crfree(cr); 460 ASSERT3S(error, <=, 0); 461 462 return (error); 463 } 464 465 #if defined(HAVE_PUT_LINK_COOKIE) 466 static void 467 zpl_put_link(struct inode *unused, void *cookie) 468 { 469 kmem_free(cookie, MAXPATHLEN); 470 } 471 #elif defined(HAVE_PUT_LINK_NAMEIDATA) 472 static void 473 zpl_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr) 474 { 475 const char *link = nd_get_link(nd); 476 477 if (!IS_ERR(link)) 478 kmem_free(link, MAXPATHLEN); 479 } 480 #elif defined(HAVE_PUT_LINK_DELAYED) 481 static void 482 zpl_put_link(void *ptr) 483 { 484 kmem_free(ptr, MAXPATHLEN); 485 } 486 #endif 487 488 static int 489 zpl_get_link_common(struct dentry *dentry, struct inode *ip, char **link) 490 { 491 fstrans_cookie_t cookie; 492 cred_t *cr = CRED(); 493 int error; 494 495 crhold(cr); 496 *link = NULL; 497 498 struct iovec iov; 499 iov.iov_len = MAXPATHLEN; 500 iov.iov_base = kmem_zalloc(MAXPATHLEN, KM_SLEEP); 501 502 uio_t uio; 503 uio_iovec_init(&uio, &iov, 1, 0, UIO_SYSSPACE, MAXPATHLEN - 1, 0); 504 505 cookie = spl_fstrans_mark(); 506 error = -zfs_readlink(ip, &uio, cr); 507 spl_fstrans_unmark(cookie); 508 crfree(cr); 509 510 if (error) 511 kmem_free(iov.iov_base, MAXPATHLEN); 512 else 513 *link = iov.iov_base; 514 515 return (error); 516 } 517 518 #if defined(HAVE_GET_LINK_DELAYED) 519 static const char * 520 zpl_get_link(struct dentry *dentry, struct inode *inode, 521 struct delayed_call *done) 522 { 523 char *link = NULL; 524 int error; 525 526 if (!dentry) 527 return (ERR_PTR(-ECHILD)); 528 529 error = zpl_get_link_common(dentry, inode, &link); 530 if (error) 531 return (ERR_PTR(error)); 532 533 set_delayed_call(done, zpl_put_link, link); 534 535 return (link); 536 } 537 #elif defined(HAVE_GET_LINK_COOKIE) 538 static const char * 539 zpl_get_link(struct dentry *dentry, struct inode *inode, void **cookie) 540 { 541 char *link = NULL; 542 int error; 543 544 if (!dentry) 545 return (ERR_PTR(-ECHILD)); 546 547 error = zpl_get_link_common(dentry, inode, &link); 548 if (error) 549 return (ERR_PTR(error)); 550 551 return (*cookie = link); 552 } 553 #elif defined(HAVE_FOLLOW_LINK_COOKIE) 554 static const char * 555 zpl_follow_link(struct dentry *dentry, void **cookie) 556 { 557 char *link = NULL; 558 int error; 559 560 error = zpl_get_link_common(dentry, dentry->d_inode, &link); 561 if (error) 562 return (ERR_PTR(error)); 563 564 return (*cookie = link); 565 } 566 #elif defined(HAVE_FOLLOW_LINK_NAMEIDATA) 567 static void * 568 zpl_follow_link(struct dentry *dentry, struct nameidata *nd) 569 { 570 char *link = NULL; 571 int error; 572 573 error = zpl_get_link_common(dentry, dentry->d_inode, &link); 574 if (error) 575 nd_set_link(nd, ERR_PTR(error)); 576 else 577 nd_set_link(nd, link); 578 579 return (NULL); 580 } 581 #endif 582 583 static int 584 zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 585 { 586 cred_t *cr = CRED(); 587 struct inode *ip = old_dentry->d_inode; 588 int error; 589 fstrans_cookie_t cookie; 590 591 if (ip->i_nlink >= ZFS_LINK_MAX) 592 return (-EMLINK); 593 594 crhold(cr); 595 ip->i_ctime = current_time(ip); 596 igrab(ip); /* Use ihold() if available */ 597 598 cookie = spl_fstrans_mark(); 599 error = -zfs_link(ITOZ(dir), ITOZ(ip), dname(dentry), cr, 0); 600 if (error) { 601 iput(ip); 602 goto out; 603 } 604 605 d_instantiate(dentry, ip); 606 out: 607 spl_fstrans_unmark(cookie); 608 crfree(cr); 609 ASSERT3S(error, <=, 0); 610 611 return (error); 612 } 613 614 static int 615 #ifdef HAVE_D_REVALIDATE_NAMEIDATA 616 zpl_revalidate(struct dentry *dentry, struct nameidata *nd) 617 { 618 unsigned int flags = (nd ? nd->flags : 0); 619 #else 620 zpl_revalidate(struct dentry *dentry, unsigned int flags) 621 { 622 #endif /* HAVE_D_REVALIDATE_NAMEIDATA */ 623 /* CSTYLED */ 624 zfsvfs_t *zfsvfs = dentry->d_sb->s_fs_info; 625 int error; 626 627 if (flags & LOOKUP_RCU) 628 return (-ECHILD); 629 630 /* 631 * After a rollback negative dentries created before the rollback 632 * time must be invalidated. Otherwise they can obscure files which 633 * are only present in the rolled back dataset. 634 */ 635 if (dentry->d_inode == NULL) { 636 spin_lock(&dentry->d_lock); 637 error = time_before(dentry->d_time, zfsvfs->z_rollback_time); 638 spin_unlock(&dentry->d_lock); 639 640 if (error) 641 return (0); 642 } 643 644 /* 645 * The dentry may reference a stale inode if a mounted file system 646 * was rolled back to a point in time where the object didn't exist. 647 */ 648 if (dentry->d_inode && ITOZ(dentry->d_inode)->z_is_stale) 649 return (0); 650 651 return (1); 652 } 653 654 const struct inode_operations zpl_inode_operations = { 655 .setattr = zpl_setattr, 656 .getattr = zpl_getattr, 657 #ifdef HAVE_GENERIC_SETXATTR 658 .setxattr = generic_setxattr, 659 .getxattr = generic_getxattr, 660 .removexattr = generic_removexattr, 661 #endif 662 .listxattr = zpl_xattr_list, 663 #if defined(CONFIG_FS_POSIX_ACL) 664 #if defined(HAVE_SET_ACL) 665 .set_acl = zpl_set_acl, 666 #endif /* HAVE_SET_ACL */ 667 .get_acl = zpl_get_acl, 668 #endif /* CONFIG_FS_POSIX_ACL */ 669 }; 670 671 const struct inode_operations zpl_dir_inode_operations = { 672 .create = zpl_create, 673 .lookup = zpl_lookup, 674 .link = zpl_link, 675 .unlink = zpl_unlink, 676 .symlink = zpl_symlink, 677 .mkdir = zpl_mkdir, 678 .rmdir = zpl_rmdir, 679 .mknod = zpl_mknod, 680 #ifdef HAVE_RENAME_WANTS_FLAGS 681 .rename = zpl_rename2, 682 #else 683 .rename = zpl_rename, 684 #endif 685 #ifdef HAVE_TMPFILE 686 .tmpfile = zpl_tmpfile, 687 #endif 688 .setattr = zpl_setattr, 689 .getattr = zpl_getattr, 690 #ifdef HAVE_GENERIC_SETXATTR 691 .setxattr = generic_setxattr, 692 .getxattr = generic_getxattr, 693 .removexattr = generic_removexattr, 694 #endif 695 .listxattr = zpl_xattr_list, 696 #if defined(CONFIG_FS_POSIX_ACL) 697 #if defined(HAVE_SET_ACL) 698 .set_acl = zpl_set_acl, 699 #endif /* HAVE_SET_ACL */ 700 .get_acl = zpl_get_acl, 701 #endif /* CONFIG_FS_POSIX_ACL */ 702 }; 703 704 const struct inode_operations zpl_symlink_inode_operations = { 705 #ifdef HAVE_GENERIC_READLINK 706 .readlink = generic_readlink, 707 #endif 708 #if defined(HAVE_GET_LINK_DELAYED) || defined(HAVE_GET_LINK_COOKIE) 709 .get_link = zpl_get_link, 710 #elif defined(HAVE_FOLLOW_LINK_COOKIE) || defined(HAVE_FOLLOW_LINK_NAMEIDATA) 711 .follow_link = zpl_follow_link, 712 #endif 713 #if defined(HAVE_PUT_LINK_COOKIE) || defined(HAVE_PUT_LINK_NAMEIDATA) 714 .put_link = zpl_put_link, 715 #endif 716 .setattr = zpl_setattr, 717 .getattr = zpl_getattr, 718 #ifdef HAVE_GENERIC_SETXATTR 719 .setxattr = generic_setxattr, 720 .getxattr = generic_getxattr, 721 .removexattr = generic_removexattr, 722 #endif 723 .listxattr = zpl_xattr_list, 724 }; 725 726 const struct inode_operations zpl_special_inode_operations = { 727 .setattr = zpl_setattr, 728 .getattr = zpl_getattr, 729 #ifdef HAVE_GENERIC_SETXATTR 730 .setxattr = generic_setxattr, 731 .getxattr = generic_getxattr, 732 .removexattr = generic_removexattr, 733 #endif 734 .listxattr = zpl_xattr_list, 735 #if defined(CONFIG_FS_POSIX_ACL) 736 #if defined(HAVE_SET_ACL) 737 .set_acl = zpl_set_acl, 738 #endif /* HAVE_SET_ACL */ 739 .get_acl = zpl_get_acl, 740 #endif /* CONFIG_FS_POSIX_ACL */ 741 }; 742 743 dentry_operations_t zpl_dentry_operations = { 744 .d_revalidate = zpl_revalidate, 745 }; 746