]> git.proxmox.com Git - mirror_zfs-debian.git/blob - module/zfs/zpl_inode.c
Imported Upstream version 0.6.5.9
[mirror_zfs-debian.git] / module / zfs / zpl_inode.c
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 #ifdef HAVE_LOOKUP_NAMEIDATA
39 zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
40 #else
41 zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
42 #endif
43 {
44 cred_t *cr = CRED();
45 struct inode *ip;
46 int error;
47 fstrans_cookie_t cookie;
48 pathname_t *ppn = NULL;
49 pathname_t pn;
50 int zfs_flags = 0;
51 zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
52
53 if (dlen(dentry) > ZFS_MAXNAMELEN)
54 return (ERR_PTR(-ENAMETOOLONG));
55
56 crhold(cr);
57 cookie = spl_fstrans_mark();
58
59 /* If we are a case insensitive fs, we need the real name */
60 if (zsb->z_case == ZFS_CASE_INSENSITIVE) {
61 zfs_flags = FIGNORECASE;
62 pn.pn_bufsize = ZFS_MAXNAMELEN;
63 pn.pn_buf = kmem_zalloc(ZFS_MAXNAMELEN, KM_SLEEP);
64 ppn = &pn;
65 }
66
67 error = -zfs_lookup(dir, dname(dentry), &ip, zfs_flags, cr, NULL, ppn);
68 spl_fstrans_unmark(cookie);
69 ASSERT3S(error, <=, 0);
70 crfree(cr);
71
72 spin_lock(&dentry->d_lock);
73 dentry->d_time = jiffies;
74 #ifndef HAVE_S_D_OP
75 d_set_d_op(dentry, &zpl_dentry_operations);
76 #endif /* HAVE_S_D_OP */
77 spin_unlock(&dentry->d_lock);
78
79 if (error) {
80 /*
81 * If we have a case sensitive fs, we do not want to
82 * insert negative entries, so return NULL for ENOENT.
83 * Fall through if the error is not ENOENT. Also free memory.
84 */
85 if (ppn) {
86 kmem_free(pn.pn_buf, ZFS_MAXNAMELEN);
87 if (error == -ENOENT)
88 return (NULL);
89 }
90
91 if (error == -ENOENT)
92 return (d_splice_alias(NULL, dentry));
93 else
94 return (ERR_PTR(error));
95 }
96
97 /*
98 * If we are case insensitive, call the correct function
99 * to install the name.
100 */
101 if (ppn) {
102 struct dentry *new_dentry;
103 struct qstr ci_name;
104
105 if (strcmp(dname(dentry), pn.pn_buf) == 0) {
106 new_dentry = d_splice_alias(ip, dentry);
107 } else {
108 ci_name.name = pn.pn_buf;
109 ci_name.len = strlen(pn.pn_buf);
110 new_dentry = d_add_ci(dentry, ip, &ci_name);
111 }
112 kmem_free(pn.pn_buf, ZFS_MAXNAMELEN);
113 return (new_dentry);
114 } else {
115 return (d_splice_alias(ip, dentry));
116 }
117 }
118
119 void
120 zpl_vap_init(vattr_t *vap, struct inode *dir, zpl_umode_t mode, cred_t *cr)
121 {
122 vap->va_mask = ATTR_MODE;
123 vap->va_mode = mode;
124 vap->va_uid = crgetfsuid(cr);
125
126 if (dir && dir->i_mode & S_ISGID) {
127 vap->va_gid = KGID_TO_SGID(dir->i_gid);
128 if (S_ISDIR(mode))
129 vap->va_mode |= S_ISGID;
130 } else {
131 vap->va_gid = crgetfsgid(cr);
132 }
133 }
134
135 static int
136 #ifdef HAVE_CREATE_NAMEIDATA
137 zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
138 struct nameidata *nd)
139 #else
140 zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
141 bool flag)
142 #endif
143 {
144 cred_t *cr = CRED();
145 struct inode *ip;
146 vattr_t *vap;
147 int error;
148 fstrans_cookie_t cookie;
149
150 crhold(cr);
151 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
152 zpl_vap_init(vap, dir, mode, cr);
153
154 cookie = spl_fstrans_mark();
155 error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
156 if (error == 0) {
157 d_instantiate(dentry, ip);
158
159 error = zpl_xattr_security_init(ip, dir, &dentry->d_name);
160 if (error == 0)
161 error = zpl_init_acl(ip, dir);
162
163 if (error)
164 (void) zfs_remove(dir, dname(dentry), cr);
165 }
166
167 spl_fstrans_unmark(cookie);
168 kmem_free(vap, sizeof (vattr_t));
169 crfree(cr);
170 ASSERT3S(error, <=, 0);
171
172 return (error);
173 }
174
175 static int
176 zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
177 dev_t rdev)
178 {
179 cred_t *cr = CRED();
180 struct inode *ip;
181 vattr_t *vap;
182 int error;
183 fstrans_cookie_t cookie;
184
185 /*
186 * We currently expect Linux to supply rdev=0 for all sockets
187 * and fifos, but we want to know if this behavior ever changes.
188 */
189 if (S_ISSOCK(mode) || S_ISFIFO(mode))
190 ASSERT(rdev == 0);
191
192 crhold(cr);
193 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
194 zpl_vap_init(vap, dir, mode, cr);
195 vap->va_rdev = rdev;
196
197 cookie = spl_fstrans_mark();
198 error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
199 if (error == 0) {
200 d_instantiate(dentry, ip);
201
202 error = zpl_xattr_security_init(ip, dir, &dentry->d_name);
203 if (error == 0)
204 error = zpl_init_acl(ip, dir);
205
206 if (error)
207 (void) zfs_remove(dir, dname(dentry), cr);
208 }
209
210 spl_fstrans_unmark(cookie);
211 kmem_free(vap, sizeof (vattr_t));
212 crfree(cr);
213 ASSERT3S(error, <=, 0);
214
215 return (error);
216 }
217
218 static int
219 zpl_unlink(struct inode *dir, struct dentry *dentry)
220 {
221 cred_t *cr = CRED();
222 int error;
223 fstrans_cookie_t cookie;
224 zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
225
226 crhold(cr);
227 cookie = spl_fstrans_mark();
228 error = -zfs_remove(dir, dname(dentry), cr);
229
230 /*
231 * For a CI FS we must invalidate the dentry to prevent the
232 * creation of negative entries.
233 */
234 if (error == 0 && zsb->z_case == ZFS_CASE_INSENSITIVE)
235 d_invalidate(dentry);
236
237 spl_fstrans_unmark(cookie);
238 crfree(cr);
239 ASSERT3S(error, <=, 0);
240
241 return (error);
242 }
243
244 static int
245 zpl_mkdir(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)
246 {
247 cred_t *cr = CRED();
248 vattr_t *vap;
249 struct inode *ip;
250 int error;
251 fstrans_cookie_t cookie;
252
253 crhold(cr);
254 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
255 zpl_vap_init(vap, dir, mode | S_IFDIR, cr);
256
257 cookie = spl_fstrans_mark();
258 error = -zfs_mkdir(dir, dname(dentry), vap, &ip, cr, 0, NULL);
259 if (error == 0) {
260 d_instantiate(dentry, ip);
261
262 error = zpl_xattr_security_init(ip, dir, &dentry->d_name);
263 if (error == 0)
264 error = zpl_init_acl(ip, dir);
265
266 if (error)
267 (void) zfs_rmdir(dir, dname(dentry), NULL, cr, 0);
268 }
269
270 spl_fstrans_unmark(cookie);
271 kmem_free(vap, sizeof (vattr_t));
272 crfree(cr);
273 ASSERT3S(error, <=, 0);
274
275 return (error);
276 }
277
278 static int
279 zpl_rmdir(struct inode * dir, struct dentry *dentry)
280 {
281 cred_t *cr = CRED();
282 int error;
283 fstrans_cookie_t cookie;
284 zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
285
286 crhold(cr);
287 cookie = spl_fstrans_mark();
288 error = -zfs_rmdir(dir, dname(dentry), NULL, cr, 0);
289
290 /*
291 * For a CI FS we must invalidate the dentry to prevent the
292 * creation of negative entries.
293 */
294 if (error == 0 && zsb->z_case == ZFS_CASE_INSENSITIVE)
295 d_invalidate(dentry);
296
297 spl_fstrans_unmark(cookie);
298 crfree(cr);
299 ASSERT3S(error, <=, 0);
300
301 return (error);
302 }
303
304 static int
305 zpl_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
306 {
307 int error;
308 fstrans_cookie_t cookie;
309
310 cookie = spl_fstrans_mark();
311 error = -zfs_getattr_fast(dentry->d_inode, stat);
312 spl_fstrans_unmark(cookie);
313 ASSERT3S(error, <=, 0);
314
315 return (error);
316 }
317
318 static int
319 zpl_setattr(struct dentry *dentry, struct iattr *ia)
320 {
321 struct inode *ip = dentry->d_inode;
322 cred_t *cr = CRED();
323 vattr_t *vap;
324 int error;
325 fstrans_cookie_t cookie;
326
327 error = setattr_prepare(dentry, ia);
328 if (error)
329 return (error);
330
331 crhold(cr);
332 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
333 vap->va_mask = ia->ia_valid & ATTR_IATTR_MASK;
334 vap->va_mode = ia->ia_mode;
335 vap->va_uid = KUID_TO_SUID(ia->ia_uid);
336 vap->va_gid = KGID_TO_SGID(ia->ia_gid);
337 vap->va_size = ia->ia_size;
338 vap->va_atime = ia->ia_atime;
339 vap->va_mtime = ia->ia_mtime;
340 vap->va_ctime = ia->ia_ctime;
341
342 if (vap->va_mask & ATTR_ATIME)
343 ip->i_atime = ia->ia_atime;
344
345 cookie = spl_fstrans_mark();
346 error = -zfs_setattr(ip, vap, 0, cr);
347 if (!error && (ia->ia_valid & ATTR_MODE))
348 error = zpl_chmod_acl(ip);
349
350 spl_fstrans_unmark(cookie);
351 kmem_free(vap, sizeof (vattr_t));
352 crfree(cr);
353 ASSERT3S(error, <=, 0);
354
355 return (error);
356 }
357
358 static int
359 zpl_rename2(struct inode *sdip, struct dentry *sdentry,
360 struct inode *tdip, struct dentry *tdentry, unsigned int flags)
361 {
362 cred_t *cr = CRED();
363 int error;
364 fstrans_cookie_t cookie;
365
366 /* We don't have renameat2(2) support */
367 if (flags)
368 return (-EINVAL);
369
370 crhold(cr);
371 cookie = spl_fstrans_mark();
372 error = -zfs_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0);
373 spl_fstrans_unmark(cookie);
374 crfree(cr);
375 ASSERT3S(error, <=, 0);
376
377 return (error);
378 }
379
380 #ifndef HAVE_RENAME_WANTS_FLAGS
381 static int
382 zpl_rename(struct inode *sdip, struct dentry *sdentry,
383 struct inode *tdip, struct dentry *tdentry)
384 {
385 return (zpl_rename2(sdip, sdentry, tdip, tdentry, 0));
386 }
387 #endif
388
389 static int
390 zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
391 {
392 cred_t *cr = CRED();
393 vattr_t *vap;
394 struct inode *ip;
395 int error;
396 fstrans_cookie_t cookie;
397
398 crhold(cr);
399 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
400 zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr);
401
402 cookie = spl_fstrans_mark();
403 error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0);
404 if (error == 0) {
405 d_instantiate(dentry, ip);
406
407 error = zpl_xattr_security_init(ip, dir, &dentry->d_name);
408 if (error)
409 (void) zfs_remove(dir, dname(dentry), cr);
410 }
411
412 spl_fstrans_unmark(cookie);
413 kmem_free(vap, sizeof (vattr_t));
414 crfree(cr);
415 ASSERT3S(error, <=, 0);
416
417 return (error);
418 }
419
420 #if defined(HAVE_PUT_LINK_COOKIE)
421 static void
422 zpl_put_link(struct inode *unused, void *cookie)
423 {
424 kmem_free(cookie, MAXPATHLEN);
425 }
426 #elif defined(HAVE_PUT_LINK_NAMEIDATA)
427 static void
428 zpl_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
429 {
430 const char *link = nd_get_link(nd);
431
432 if (!IS_ERR(link))
433 kmem_free(link, MAXPATHLEN);
434 }
435 #elif defined(HAVE_PUT_LINK_DELAYED)
436 static void
437 zpl_put_link(void *ptr)
438 {
439 kmem_free(ptr, MAXPATHLEN);
440 }
441 #endif
442
443 static int
444 zpl_get_link_common(struct dentry *dentry, struct inode *ip, char **link)
445 {
446 fstrans_cookie_t cookie;
447 cred_t *cr = CRED();
448 struct iovec iov;
449 uio_t uio;
450 int error;
451
452 crhold(cr);
453 *link = NULL;
454 iov.iov_len = MAXPATHLEN;
455 iov.iov_base = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
456
457 uio.uio_iov = &iov;
458 uio.uio_iovcnt = 1;
459 uio.uio_skip = 0;
460 uio.uio_resid = (MAXPATHLEN - 1);
461 uio.uio_segflg = UIO_SYSSPACE;
462
463 cookie = spl_fstrans_mark();
464 error = -zfs_readlink(ip, &uio, cr);
465 spl_fstrans_unmark(cookie);
466 crfree(cr);
467
468 if (error)
469 kmem_free(iov.iov_base, MAXPATHLEN);
470 else
471 *link = iov.iov_base;
472
473 return (error);
474 }
475
476 #if defined(HAVE_GET_LINK_DELAYED)
477 const char *
478 zpl_get_link(struct dentry *dentry, struct inode *inode,
479 struct delayed_call *done)
480 {
481 char *link = NULL;
482 int error;
483
484 if (!dentry)
485 return (ERR_PTR(-ECHILD));
486
487 error = zpl_get_link_common(dentry, inode, &link);
488 if (error)
489 return (ERR_PTR(error));
490
491 set_delayed_call(done, zpl_put_link, link);
492
493 return (link);
494 }
495 #elif defined(HAVE_GET_LINK_COOKIE)
496 const char *
497 zpl_get_link(struct dentry *dentry, struct inode *inode, void **cookie)
498 {
499 char *link = NULL;
500 int error;
501
502 if (!dentry)
503 return (ERR_PTR(-ECHILD));
504
505 error = zpl_get_link_common(dentry, inode, &link);
506 if (error)
507 return (ERR_PTR(error));
508
509 return (*cookie = link);
510 }
511 #elif defined(HAVE_FOLLOW_LINK_COOKIE)
512 const char *
513 zpl_follow_link(struct dentry *dentry, void **cookie)
514 {
515 char *link = NULL;
516 int error;
517
518 error = zpl_get_link_common(dentry, dentry->d_inode, &link);
519 if (error)
520 return (ERR_PTR(error));
521
522 return (*cookie = link);
523 }
524 #elif defined(HAVE_FOLLOW_LINK_NAMEIDATA)
525 static void *
526 zpl_follow_link(struct dentry *dentry, struct nameidata *nd)
527 {
528 char *link = NULL;
529 int error;
530
531 error = zpl_get_link_common(dentry, dentry->d_inode, &link);
532 if (error)
533 nd_set_link(nd, ERR_PTR(error));
534 else
535 nd_set_link(nd, link);
536
537 return (NULL);
538 }
539 #endif
540
541 static int
542 zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
543 {
544 cred_t *cr = CRED();
545 struct inode *ip = old_dentry->d_inode;
546 int error;
547 fstrans_cookie_t cookie;
548
549 if (ip->i_nlink >= ZFS_LINK_MAX)
550 return (-EMLINK);
551
552 crhold(cr);
553 ip->i_ctime = CURRENT_TIME_SEC;
554 igrab(ip); /* Use ihold() if available */
555
556 cookie = spl_fstrans_mark();
557 error = -zfs_link(dir, ip, dname(dentry), cr);
558 if (error) {
559 iput(ip);
560 goto out;
561 }
562
563 d_instantiate(dentry, ip);
564 out:
565 spl_fstrans_unmark(cookie);
566 crfree(cr);
567 ASSERT3S(error, <=, 0);
568
569 return (error);
570 }
571
572 #ifdef HAVE_INODE_TRUNCATE_RANGE
573 static void
574 zpl_truncate_range(struct inode *ip, loff_t start, loff_t end)
575 {
576 cred_t *cr = CRED();
577 flock64_t bf;
578 fstrans_cookie_t cookie;
579
580 ASSERT3S(start, <=, end);
581
582 /*
583 * zfs_freesp() will interpret (len == 0) as meaning "truncate until
584 * the end of the file". We don't want that.
585 */
586 if (start == end)
587 return;
588
589 crhold(cr);
590
591 bf.l_type = F_WRLCK;
592 bf.l_whence = 0;
593 bf.l_start = start;
594 bf.l_len = end - start;
595 bf.l_pid = 0;
596 cookie = spl_fstrans_mark();
597 zfs_space(ip, F_FREESP, &bf, FWRITE, start, cr);
598 spl_fstrans_unmark(cookie);
599
600 crfree(cr);
601 }
602 #endif /* HAVE_INODE_TRUNCATE_RANGE */
603
604 #ifdef HAVE_INODE_FALLOCATE
605 static long
606 zpl_fallocate(struct inode *ip, int mode, loff_t offset, loff_t len)
607 {
608 return (zpl_fallocate_common(ip, mode, offset, len));
609 }
610 #endif /* HAVE_INODE_FALLOCATE */
611
612 static int
613 #ifdef HAVE_D_REVALIDATE_NAMEIDATA
614 zpl_revalidate(struct dentry *dentry, struct nameidata *nd)
615 {
616 unsigned int flags = (nd ? nd->flags : 0);
617 #else
618 zpl_revalidate(struct dentry *dentry, unsigned int flags)
619 {
620 #endif /* HAVE_D_REVALIDATE_NAMEIDATA */
621 zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
622 int error;
623
624 if (flags & LOOKUP_RCU)
625 return (-ECHILD);
626
627 /*
628 * Automounted snapshots rely on periodic dentry revalidation
629 * to defer snapshots from being automatically unmounted.
630 */
631 if (zsb->z_issnap) {
632 if (time_after(jiffies, zsb->z_snap_defer_time +
633 MAX(zfs_expire_snapshot * HZ / 2, HZ))) {
634 zsb->z_snap_defer_time = jiffies;
635 zfsctl_snapshot_unmount_delay(zsb->z_os->os_spa,
636 dmu_objset_id(zsb->z_os), zfs_expire_snapshot);
637 }
638 }
639
640 /*
641 * After a rollback negative dentries created before the rollback
642 * time must be invalidated. Otherwise they can obscure files which
643 * are only present in the rolled back dataset.
644 */
645 if (dentry->d_inode == NULL) {
646 spin_lock(&dentry->d_lock);
647 error = time_before(dentry->d_time, zsb->z_rollback_time);
648 spin_unlock(&dentry->d_lock);
649
650 if (error)
651 return (0);
652 }
653
654 /*
655 * The dentry may reference a stale inode if a mounted file system
656 * was rolled back to a point in time where the object didn't exist.
657 */
658 if (dentry->d_inode && ITOZ(dentry->d_inode)->z_is_stale)
659 return (0);
660
661 return (1);
662 }
663
664 const struct inode_operations zpl_inode_operations = {
665 .setattr = zpl_setattr,
666 .getattr = zpl_getattr,
667 #ifdef HAVE_GENERIC_SETXATTR
668 .setxattr = generic_setxattr,
669 .getxattr = generic_getxattr,
670 .removexattr = generic_removexattr,
671 #endif
672 .listxattr = zpl_xattr_list,
673 #ifdef HAVE_INODE_TRUNCATE_RANGE
674 .truncate_range = zpl_truncate_range,
675 #endif /* HAVE_INODE_TRUNCATE_RANGE */
676 #ifdef HAVE_INODE_FALLOCATE
677 .fallocate = zpl_fallocate,
678 #endif /* HAVE_INODE_FALLOCATE */
679 #if defined(CONFIG_FS_POSIX_ACL)
680 #if defined(HAVE_SET_ACL)
681 .set_acl = zpl_set_acl,
682 #endif
683 #if defined(HAVE_GET_ACL)
684 .get_acl = zpl_get_acl,
685 #elif defined(HAVE_CHECK_ACL)
686 .check_acl = zpl_check_acl,
687 #elif defined(HAVE_PERMISSION)
688 .permission = zpl_permission,
689 #endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
690 #endif /* CONFIG_FS_POSIX_ACL */
691 };
692
693 const struct inode_operations zpl_dir_inode_operations = {
694 .create = zpl_create,
695 .lookup = zpl_lookup,
696 .link = zpl_link,
697 .unlink = zpl_unlink,
698 .symlink = zpl_symlink,
699 .mkdir = zpl_mkdir,
700 .rmdir = zpl_rmdir,
701 .mknod = zpl_mknod,
702 #ifdef HAVE_RENAME_WANTS_FLAGS
703 .rename = zpl_rename2,
704 #else
705 .rename = zpl_rename,
706 #endif
707 .setattr = zpl_setattr,
708 .getattr = zpl_getattr,
709 #ifdef HAVE_GENERIC_SETXATTR
710 .setxattr = generic_setxattr,
711 .getxattr = generic_getxattr,
712 .removexattr = generic_removexattr,
713 #endif
714 .listxattr = zpl_xattr_list,
715 #if defined(CONFIG_FS_POSIX_ACL)
716 #if defined(HAVE_SET_ACL)
717 .set_acl = zpl_set_acl,
718 #endif
719 #if defined(HAVE_GET_ACL)
720 .get_acl = zpl_get_acl,
721 #elif defined(HAVE_CHECK_ACL)
722 .check_acl = zpl_check_acl,
723 #elif defined(HAVE_PERMISSION)
724 .permission = zpl_permission,
725 #endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
726 #endif /* CONFIG_FS_POSIX_ACL */
727 };
728
729 const struct inode_operations zpl_symlink_inode_operations = {
730 #ifdef HAVE_GENERIC_READLINK
731 .readlink = generic_readlink,
732 #endif
733 #if defined(HAVE_GET_LINK_DELAYED) || defined(HAVE_GET_LINK_COOKIE)
734 .get_link = zpl_get_link,
735 #elif defined(HAVE_FOLLOW_LINK_COOKIE) || defined(HAVE_FOLLOW_LINK_NAMEIDATA)
736 .follow_link = zpl_follow_link,
737 #endif
738 #if defined(HAVE_PUT_LINK_COOKIE) || defined(HAVE_PUT_LINK_NAMEIDATA)
739 .put_link = zpl_put_link,
740 #endif
741 .setattr = zpl_setattr,
742 .getattr = zpl_getattr,
743 #ifdef HAVE_GENERIC_SETXATTR
744 .setxattr = generic_setxattr,
745 .getxattr = generic_getxattr,
746 .removexattr = generic_removexattr,
747 #endif
748 .listxattr = zpl_xattr_list,
749 };
750
751 const struct inode_operations zpl_special_inode_operations = {
752 .setattr = zpl_setattr,
753 .getattr = zpl_getattr,
754 #ifdef HAVE_GENERIC_SETXATTR
755 .setxattr = generic_setxattr,
756 .getxattr = generic_getxattr,
757 .removexattr = generic_removexattr,
758 #endif
759 .listxattr = zpl_xattr_list,
760 #if defined(CONFIG_FS_POSIX_ACL)
761 #if defined(HAVE_SET_ACL)
762 .set_acl = zpl_set_acl,
763 #endif
764 #if defined(HAVE_GET_ACL)
765 .get_acl = zpl_get_acl,
766 #elif defined(HAVE_CHECK_ACL)
767 .check_acl = zpl_check_acl,
768 #elif defined(HAVE_PERMISSION)
769 .permission = zpl_permission,
770 #endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
771 #endif /* CONFIG_FS_POSIX_ACL */
772 };
773
774 dentry_operations_t zpl_dentry_operations = {
775 .d_revalidate = zpl_revalidate,
776 };