X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_export.c;h=94625e13c85a3e44dc7ad6993674edfe79174a1a;hb=556011dbec2d10579819078559a77630fc559112;hp=4fe998437f6aadfaa339e52f406f3c26ab1619fe;hpb=2cf7f52bc42f215d4ef27d0fd75fc1b1417cb841;p=zfs.git diff --git a/module/zfs/zpl_export.c b/module/zfs/zpl_export.c index 4fe9984..94625e1 100644 --- a/module/zfs/zpl_export.c +++ b/module/zfs/zpl_export.c @@ -20,19 +20,26 @@ */ /* * Copyright (c) 2011 Gunnar Beutner + * Copyright (c) 2012 Cyril Plisko. All rights reserved. */ #include #include +#include #include static int +#ifdef HAVE_ENCODE_FH_WITH_INODE +zpl_encode_fh(struct inode *ip, __u32 *fh, int *max_len, struct inode *parent) +{ +#else zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable) { - fid_t *fid = (fid_t *)fh; struct inode *ip = dentry->d_inode; +#endif /* HAVE_ENCODE_FH_WITH_INODE */ + fid_t *fid = (fid_t *)fh; int len_bytes, rc; len_bytes = *max_len * sizeof (__u32); @@ -42,7 +49,10 @@ zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable) fid->fid_len = len_bytes - offsetof(fid_t, fid_data); - rc = zfs_fid(ip, fid); + if (zfsctl_is_node(ip)) + rc = zfsctl_fid(ip, fid); + else + rc = zfs_fid(ip, fid); len_bytes = offsetof(fid_t, fid_data) + fid->fid_len; *max_len = roundup(len_bytes, sizeof (__u32)) / sizeof (__u32); @@ -112,8 +122,27 @@ zpl_get_parent(struct dentry *child) return zpl_dentry_obtain_alias(ip); } +#ifdef HAVE_COMMIT_METADATA +static int +zpl_commit_metadata(struct inode *inode) +{ + cred_t *cr = CRED(); + int error; + + crhold(cr); + error = -zfs_fsync(inode, 0, cr); + crfree(cr); + ASSERT3S(error, <=, 0); + + return error; +} +#endif /* HAVE_COMMIT_METADATA */ + const struct export_operations zpl_export_operations = { .encode_fh = zpl_encode_fh, .fh_to_dentry = zpl_fh_to_dentry, - .get_parent = zpl_get_parent + .get_parent = zpl_get_parent, +#ifdef HAVE_COMMIT_METADATA + .commit_metadata= zpl_commit_metadata, +#endif /* HAVE_COMMIT_METADATA */ };