Add a mount flag to control use of OBD_IOC_FID2PATH by processes
without CFS_CAP_DAC_READ_SEARCH.
Change-Id: Ibbca25ad511d80e245716d27fca4287979667db6
Signed-off-by: John L. Hammond <jhammond@tacc.utexas.edu>
Reviewed-on: http://review.whamcloud.com/3104
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: wangdi <di.wang@whamcloud.com>
Reviewed-by: Keith Mannthey <keith@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
.TP
.BI noverbose
Disable mount/umount console messages.
.TP
.BI noverbose
Disable mount/umount console messages.
+.TP
+.BI user_fid2path
+Enable FID to path translation by regular users.
+.TP
+.BI nouser_fid2path
+Disable FID to path translation by regular users. Root and process with
+CAP_DAC_READ_SEARCH can still perform FID to path translation.
.PP
In addition to the standard mount options and backing disk type
(e.g. ext3) options listed in
.PP
In addition to the standard mount options and backing disk type
(e.g. ext3) options listed in
sizeof(struct ioc_changelog));
RETURN(rc);
case OBD_IOC_FID2PATH:
sizeof(struct ioc_changelog));
RETURN(rc);
case OBD_IOC_FID2PATH:
- RETURN(ll_fid2path(ll_i2mdexp(inode), (void *)arg));
+ RETURN(ll_fid2path(inode, (void *)arg));
case LL_IOC_HSM_CT_START:
rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
sizeof(struct lustre_kernelcomm));
case LL_IOC_HSM_CT_START:
rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
sizeof(struct lustre_kernelcomm));
-int ll_fid2path(struct obd_export *exp, void *arg)
+int ll_fid2path(struct inode *inode, void *arg)
+ struct obd_export *exp = ll_i2mdexp(inode);
struct getinfo_fid2path *gfout, *gfin;
int outsize, rc;
ENTRY;
struct getinfo_fid2path *gfout, *gfin;
int outsize, rc;
ENTRY;
+ if (!cfs_capable(CFS_CAP_DAC_READ_SEARCH) &&
+ !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
+ RETURN(-EPERM);
+
/* Need to get the buflen */
OBD_ALLOC_PTR(gfin);
if (gfin == NULL)
/* Need to get the buflen */
OBD_ALLOC_PTR(gfin);
if (gfin == NULL)
RETURN(0);
}
case OBD_IOC_FID2PATH:
RETURN(0);
}
case OBD_IOC_FID2PATH:
- RETURN(ll_fid2path(ll_i2mdexp(inode), (void *)arg));
+ RETURN(ll_fid2path(inode, (void *)arg));
case LL_IOC_DATA_VERSION: {
struct ioc_data_version idv;
int rc;
case LL_IOC_DATA_VERSION: {
struct ioc_data_version idv;
int rc;
#define LL_SBI_AGL_ENABLED 0x8000 /* enable agl */
#define LL_SBI_VERBOSE 0x10000 /* verbose mount/umount */
#define LL_SBI_LAYOUT_LOCK 0x20000 /* layout lock support */
#define LL_SBI_AGL_ENABLED 0x8000 /* enable agl */
#define LL_SBI_VERBOSE 0x10000 /* verbose mount/umount */
#define LL_SBI_LAYOUT_LOCK 0x20000 /* layout lock support */
+#define LL_SBI_USER_FID2PATH 0x40000 /* allow fid2path by unprivileged users */
/* default value for ll_sb_info->contention_time */
#define SBI_DEFAULT_CONTENTION_SECONDS 60
/* default value for ll_sb_info->contention_time */
#define SBI_DEFAULT_CONTENTION_SECONDS 60
int ll_merge_lvb(struct inode *inode);
int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg);
int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
int ll_merge_lvb(struct inode *inode);
int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg);
int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
-int ll_fid2path(struct obd_export *exp, void *arg);
+int ll_fid2path(struct inode *inode, void *arg);
*flags |= tmp;
goto next;
}
*flags |= tmp;
goto next;
}
+ tmp = ll_set_opt("user_fid2path", s1, LL_SBI_USER_FID2PATH);
+ if (tmp) {
+ *flags |= tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("nouser_fid2path", s1, LL_SBI_USER_FID2PATH);
+ if (tmp) {
+ *flags &= ~tmp;
+ goto next;
+ }
tmp = ll_set_opt("checksum", s1, LL_SBI_CHECKSUM);
if (tmp) {
tmp = ll_set_opt("checksum", s1, LL_SBI_CHECKSUM);
if (tmp) {
if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
seq_puts(seq, ",lazystatfs");
if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
seq_puts(seq, ",lazystatfs");
+ if (sbi->ll_flags & LL_SBI_USER_FID2PATH)
+ seq_puts(seq, ",user_fid2path");
+