]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - zfs/module/zfs/zpl_inode.c
UBUNTU: SAUCE: (noup) Update spl to 0.6.5.9-1ubuntu2, zfs to 0.6.5.9-5ubuntu7
[mirror_ubuntu-artful-kernel.git] / zfs / module / zfs / zpl_inode.c
CommitLineData
87d546d8
TG
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
37static struct dentry *
38#ifdef HAVE_LOOKUP_NAMEIDATA
39zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
40#else
41zpl_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
119void
120zpl_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
135static int
136#ifdef HAVE_CREATE_NAMEIDATA
137zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
138 struct nameidata *nd)
139#else
140zpl_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
175static int
176zpl_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
218static int
219zpl_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
244static int
245zpl_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
278static int
279zpl_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
304static int
3e990ae0
CIK
305zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
306 unsigned int query_flags)
87d546d8
TG
307{
308 int error;
309 fstrans_cookie_t cookie;
310
311 cookie = spl_fstrans_mark();
3e990ae0
CIK
312
313 /*
314 * XXX request_mask and query_flags currently ignored.
315 */
316
317 error = -zfs_getattr_fast(path->dentry->d_inode, stat);
87d546d8
TG
318 spl_fstrans_unmark(cookie);
319 ASSERT3S(error, <=, 0);
320
321 return (error);
322}
3e990ae0 323ZPL_GETATTR_WRAPPER(zpl_getattr);
87d546d8
TG
324
325static int
326zpl_setattr(struct dentry *dentry, struct iattr *ia)
327{
328 struct inode *ip = dentry->d_inode;
329 cred_t *cr = CRED();
330 vattr_t *vap;
331 int error;
332 fstrans_cookie_t cookie;
333
334 error = setattr_prepare(dentry, ia);
335 if (error)
336 return (error);
337
338 crhold(cr);
339 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
340 vap->va_mask = ia->ia_valid & ATTR_IATTR_MASK;
341 vap->va_mode = ia->ia_mode;
342 vap->va_uid = KUID_TO_SUID(ia->ia_uid);
343 vap->va_gid = KGID_TO_SGID(ia->ia_gid);
344 vap->va_size = ia->ia_size;
345 vap->va_atime = ia->ia_atime;
346 vap->va_mtime = ia->ia_mtime;
347 vap->va_ctime = ia->ia_ctime;
348
349 if (vap->va_mask & ATTR_ATIME)
350 ip->i_atime = ia->ia_atime;
351
352 cookie = spl_fstrans_mark();
353 error = -zfs_setattr(ip, vap, 0, cr);
354 if (!error && (ia->ia_valid & ATTR_MODE))
355 error = zpl_chmod_acl(ip);
356
357 spl_fstrans_unmark(cookie);
358 kmem_free(vap, sizeof (vattr_t));
359 crfree(cr);
360 ASSERT3S(error, <=, 0);
361
362 return (error);
363}
364
365static int
366zpl_rename2(struct inode *sdip, struct dentry *sdentry,
367 struct inode *tdip, struct dentry *tdentry, unsigned int flags)
368{
369 cred_t *cr = CRED();
370 int error;
371 fstrans_cookie_t cookie;
372
373 /* We don't have renameat2(2) support */
374 if (flags)
375 return (-EINVAL);
376
377 crhold(cr);
378 cookie = spl_fstrans_mark();
379 error = -zfs_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0);
380 spl_fstrans_unmark(cookie);
381 crfree(cr);
382 ASSERT3S(error, <=, 0);
383
384 return (error);
385}
386
387#ifndef HAVE_RENAME_WANTS_FLAGS
388static int
389zpl_rename(struct inode *sdip, struct dentry *sdentry,
390 struct inode *tdip, struct dentry *tdentry)
391{
392 return (zpl_rename2(sdip, sdentry, tdip, tdentry, 0));
393}
394#endif
395
396static int
397zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
398{
399 cred_t *cr = CRED();
400 vattr_t *vap;
401 struct inode *ip;
402 int error;
403 fstrans_cookie_t cookie;
404
405 crhold(cr);
406 vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
407 zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr);
408
409 cookie = spl_fstrans_mark();
410 error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0);
411 if (error == 0) {
412 d_instantiate(dentry, ip);
413
414 error = zpl_xattr_security_init(ip, dir, &dentry->d_name);
415 if (error)
416 (void) zfs_remove(dir, dname(dentry), cr);
417 }
418
419 spl_fstrans_unmark(cookie);
420 kmem_free(vap, sizeof (vattr_t));
421 crfree(cr);
422 ASSERT3S(error, <=, 0);
423
424 return (error);
425}
426
427#if defined(HAVE_PUT_LINK_COOKIE)
428static void
429zpl_put_link(struct inode *unused, void *cookie)
430{
431 kmem_free(cookie, MAXPATHLEN);
432}
433#elif defined(HAVE_PUT_LINK_NAMEIDATA)
434static void
435zpl_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
436{
437 const char *link = nd_get_link(nd);
438
439 if (!IS_ERR(link))
440 kmem_free(link, MAXPATHLEN);
441}
442#elif defined(HAVE_PUT_LINK_DELAYED)
443static void
444zpl_put_link(void *ptr)
445{
446 kmem_free(ptr, MAXPATHLEN);
447}
448#endif
449
450static int
451zpl_get_link_common(struct dentry *dentry, struct inode *ip, char **link)
452{
453 fstrans_cookie_t cookie;
454 cred_t *cr = CRED();
455 struct iovec iov;
456 uio_t uio;
457 int error;
458
459 crhold(cr);
460 *link = NULL;
461 iov.iov_len = MAXPATHLEN;
462 iov.iov_base = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
463
464 uio.uio_iov = &iov;
465 uio.uio_iovcnt = 1;
466 uio.uio_skip = 0;
467 uio.uio_resid = (MAXPATHLEN - 1);
468 uio.uio_segflg = UIO_SYSSPACE;
469
470 cookie = spl_fstrans_mark();
471 error = -zfs_readlink(ip, &uio, cr);
472 spl_fstrans_unmark(cookie);
473 crfree(cr);
474
475 if (error)
476 kmem_free(iov.iov_base, MAXPATHLEN);
477 else
478 *link = iov.iov_base;
479
480 return (error);
481}
482
483#if defined(HAVE_GET_LINK_DELAYED)
484const char *
485zpl_get_link(struct dentry *dentry, struct inode *inode,
486 struct delayed_call *done)
487{
488 char *link = NULL;
489 int error;
490
491 if (!dentry)
492 return (ERR_PTR(-ECHILD));
493
494 error = zpl_get_link_common(dentry, inode, &link);
495 if (error)
496 return (ERR_PTR(error));
497
498 set_delayed_call(done, zpl_put_link, link);
499
500 return (link);
501}
502#elif defined(HAVE_GET_LINK_COOKIE)
503const char *
504zpl_get_link(struct dentry *dentry, struct inode *inode, void **cookie)
505{
506 char *link = NULL;
507 int error;
508
509 if (!dentry)
510 return (ERR_PTR(-ECHILD));
511
512 error = zpl_get_link_common(dentry, inode, &link);
513 if (error)
514 return (ERR_PTR(error));
515
516 return (*cookie = link);
517}
518#elif defined(HAVE_FOLLOW_LINK_COOKIE)
519const char *
520zpl_follow_link(struct dentry *dentry, void **cookie)
521{
522 char *link = NULL;
523 int error;
524
525 error = zpl_get_link_common(dentry, dentry->d_inode, &link);
526 if (error)
527 return (ERR_PTR(error));
528
529 return (*cookie = link);
530}
531#elif defined(HAVE_FOLLOW_LINK_NAMEIDATA)
532static void *
533zpl_follow_link(struct dentry *dentry, struct nameidata *nd)
534{
535 char *link = NULL;
536 int error;
537
538 error = zpl_get_link_common(dentry, dentry->d_inode, &link);
539 if (error)
540 nd_set_link(nd, ERR_PTR(error));
541 else
542 nd_set_link(nd, link);
543
544 return (NULL);
545}
546#endif
547
548static int
549zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
550{
551 cred_t *cr = CRED();
552 struct inode *ip = old_dentry->d_inode;
553 int error;
554 fstrans_cookie_t cookie;
555
556 if (ip->i_nlink >= ZFS_LINK_MAX)
557 return (-EMLINK);
558
559 crhold(cr);
df9d7621 560 ip->i_ctime = current_time(ip);
87d546d8
TG
561 igrab(ip); /* Use ihold() if available */
562
563 cookie = spl_fstrans_mark();
564 error = -zfs_link(dir, ip, dname(dentry), cr);
565 if (error) {
566 iput(ip);
567 goto out;
568 }
569
570 d_instantiate(dentry, ip);
571out:
572 spl_fstrans_unmark(cookie);
573 crfree(cr);
574 ASSERT3S(error, <=, 0);
575
576 return (error);
577}
578
579#ifdef HAVE_INODE_TRUNCATE_RANGE
580static void
581zpl_truncate_range(struct inode *ip, loff_t start, loff_t end)
582{
583 cred_t *cr = CRED();
584 flock64_t bf;
585 fstrans_cookie_t cookie;
586
587 ASSERT3S(start, <=, end);
588
589 /*
590 * zfs_freesp() will interpret (len == 0) as meaning "truncate until
591 * the end of the file". We don't want that.
592 */
593 if (start == end)
594 return;
595
596 crhold(cr);
597
598 bf.l_type = F_WRLCK;
599 bf.l_whence = 0;
600 bf.l_start = start;
601 bf.l_len = end - start;
602 bf.l_pid = 0;
603 cookie = spl_fstrans_mark();
604 zfs_space(ip, F_FREESP, &bf, FWRITE, start, cr);
605 spl_fstrans_unmark(cookie);
606
607 crfree(cr);
608}
609#endif /* HAVE_INODE_TRUNCATE_RANGE */
610
611#ifdef HAVE_INODE_FALLOCATE
612static long
613zpl_fallocate(struct inode *ip, int mode, loff_t offset, loff_t len)
614{
615 return (zpl_fallocate_common(ip, mode, offset, len));
616}
617#endif /* HAVE_INODE_FALLOCATE */
618
619static int
620#ifdef HAVE_D_REVALIDATE_NAMEIDATA
621zpl_revalidate(struct dentry *dentry, struct nameidata *nd)
622{
623 unsigned int flags = (nd ? nd->flags : 0);
624#else
625zpl_revalidate(struct dentry *dentry, unsigned int flags)
626{
627#endif /* HAVE_D_REVALIDATE_NAMEIDATA */
628 zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
629 int error;
630
631 if (flags & LOOKUP_RCU)
632 return (-ECHILD);
633
634 /*
635 * Automounted snapshots rely on periodic dentry revalidation
636 * to defer snapshots from being automatically unmounted.
637 */
638 if (zsb->z_issnap) {
639 if (time_after(jiffies, zsb->z_snap_defer_time +
640 MAX(zfs_expire_snapshot * HZ / 2, HZ))) {
641 zsb->z_snap_defer_time = jiffies;
642 zfsctl_snapshot_unmount_delay(zsb->z_os->os_spa,
643 dmu_objset_id(zsb->z_os), zfs_expire_snapshot);
644 }
645 }
646
647 /*
648 * After a rollback negative dentries created before the rollback
649 * time must be invalidated. Otherwise they can obscure files which
650 * are only present in the rolled back dataset.
651 */
652 if (dentry->d_inode == NULL) {
653 spin_lock(&dentry->d_lock);
654 error = time_before(dentry->d_time, zsb->z_rollback_time);
655 spin_unlock(&dentry->d_lock);
656
657 if (error)
658 return (0);
659 }
660
661 /*
662 * The dentry may reference a stale inode if a mounted file system
663 * was rolled back to a point in time where the object didn't exist.
664 */
665 if (dentry->d_inode && ITOZ(dentry->d_inode)->z_is_stale)
666 return (0);
667
668 return (1);
669}
670
671const struct inode_operations zpl_inode_operations = {
672 .setattr = zpl_setattr,
673 .getattr = zpl_getattr,
674#ifdef HAVE_GENERIC_SETXATTR
675 .setxattr = generic_setxattr,
676 .getxattr = generic_getxattr,
677 .removexattr = generic_removexattr,
678#endif
679 .listxattr = zpl_xattr_list,
680#ifdef HAVE_INODE_TRUNCATE_RANGE
681 .truncate_range = zpl_truncate_range,
682#endif /* HAVE_INODE_TRUNCATE_RANGE */
683#ifdef HAVE_INODE_FALLOCATE
684 .fallocate = zpl_fallocate,
685#endif /* HAVE_INODE_FALLOCATE */
686#if defined(CONFIG_FS_POSIX_ACL)
687#if defined(HAVE_SET_ACL)
688 .set_acl = zpl_set_acl,
689#endif
690#if defined(HAVE_GET_ACL)
691 .get_acl = zpl_get_acl,
692#elif defined(HAVE_CHECK_ACL)
693 .check_acl = zpl_check_acl,
694#elif defined(HAVE_PERMISSION)
695 .permission = zpl_permission,
696#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
697#endif /* CONFIG_FS_POSIX_ACL */
698};
699
700const struct inode_operations zpl_dir_inode_operations = {
701 .create = zpl_create,
702 .lookup = zpl_lookup,
703 .link = zpl_link,
704 .unlink = zpl_unlink,
705 .symlink = zpl_symlink,
706 .mkdir = zpl_mkdir,
707 .rmdir = zpl_rmdir,
708 .mknod = zpl_mknod,
709#ifdef HAVE_RENAME_WANTS_FLAGS
710 .rename = zpl_rename2,
711#else
712 .rename = zpl_rename,
713#endif
714 .setattr = zpl_setattr,
715 .getattr = zpl_getattr,
716#ifdef HAVE_GENERIC_SETXATTR
717 .setxattr = generic_setxattr,
718 .getxattr = generic_getxattr,
719 .removexattr = generic_removexattr,
720#endif
721 .listxattr = zpl_xattr_list,
722#if defined(CONFIG_FS_POSIX_ACL)
723#if defined(HAVE_SET_ACL)
724 .set_acl = zpl_set_acl,
725#endif
726#if defined(HAVE_GET_ACL)
727 .get_acl = zpl_get_acl,
728#elif defined(HAVE_CHECK_ACL)
729 .check_acl = zpl_check_acl,
730#elif defined(HAVE_PERMISSION)
731 .permission = zpl_permission,
732#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
733#endif /* CONFIG_FS_POSIX_ACL */
734};
735
736const struct inode_operations zpl_symlink_inode_operations = {
737#ifdef HAVE_GENERIC_READLINK
738 .readlink = generic_readlink,
739#endif
740#if defined(HAVE_GET_LINK_DELAYED) || defined(HAVE_GET_LINK_COOKIE)
741 .get_link = zpl_get_link,
742#elif defined(HAVE_FOLLOW_LINK_COOKIE) || defined(HAVE_FOLLOW_LINK_NAMEIDATA)
743 .follow_link = zpl_follow_link,
744#endif
745#if defined(HAVE_PUT_LINK_COOKIE) || defined(HAVE_PUT_LINK_NAMEIDATA)
746 .put_link = zpl_put_link,
747#endif
748 .setattr = zpl_setattr,
749 .getattr = zpl_getattr,
750#ifdef HAVE_GENERIC_SETXATTR
751 .setxattr = generic_setxattr,
752 .getxattr = generic_getxattr,
753 .removexattr = generic_removexattr,
754#endif
755 .listxattr = zpl_xattr_list,
756};
757
758const struct inode_operations zpl_special_inode_operations = {
759 .setattr = zpl_setattr,
760 .getattr = zpl_getattr,
761#ifdef HAVE_GENERIC_SETXATTR
762 .setxattr = generic_setxattr,
763 .getxattr = generic_getxattr,
764 .removexattr = generic_removexattr,
765#endif
766 .listxattr = zpl_xattr_list,
767#if defined(CONFIG_FS_POSIX_ACL)
768#if defined(HAVE_SET_ACL)
769 .set_acl = zpl_set_acl,
770#endif
771#if defined(HAVE_GET_ACL)
772 .get_acl = zpl_get_acl,
773#elif defined(HAVE_CHECK_ACL)
774 .check_acl = zpl_check_acl,
775#elif defined(HAVE_PERMISSION)
776 .permission = zpl_permission,
777#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
778#endif /* CONFIG_FS_POSIX_ACL */
779};
780
781dentry_operations_t zpl_dentry_operations = {
782 .d_revalidate = zpl_revalidate,
783};