Commit d07d4cb8 authored by wang di's avatar wang di Committed by Greg Kroah-Hartman

staging: lustre: llite: use the correct mode for striped directory

Create striped directory with correct mode, which should be
handling same as mkdir.
Signed-off-by: default avatarwang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4929
Reviewed-on: http://review.whamcloud.com/10028Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 711942df
...@@ -694,28 +694,40 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string) ...@@ -694,28 +694,40 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string)
return rc; return rc;
} }
static int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump, /**
const char *filename) * Create striped directory with specified stripe(@lump)
*
* param[in] parent the parent of the directory.
* param[in] lump the specified stripes.
* param[in] dirname the name of the directory.
* param[in] mode the specified mode of the directory.
*
* retval =0 if striped directory is being created successfully.
* <0 if the creation is failed.
*/
static int ll_dir_setdirstripe(struct inode *parent, struct lmv_user_md *lump,
const char *dirname, umode_t mode)
{ {
struct ptlrpc_request *request = NULL; struct ptlrpc_request *request = NULL;
struct md_op_data *op_data; struct md_op_data *op_data;
struct ll_sb_info *sbi = ll_i2sbi(dir); struct ll_sb_info *sbi = ll_i2sbi(parent);
int mode;
int err; int err;
if (unlikely(lump->lum_magic != LMV_USER_MAGIC)) if (unlikely(lump->lum_magic != LMV_USER_MAGIC))
return -EINVAL; return -EINVAL;
CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p) name %s stripe_offset %d, stripe_count: %u\n", CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p) name %s stripe_offset %d, stripe_count: %u\n",
PFID(ll_inode2fid(dir)), dir, filename, PFID(ll_inode2fid(parent)), parent, dirname,
(int)lump->lum_stripe_offset, lump->lum_stripe_count); (int)lump->lum_stripe_offset, lump->lum_stripe_count);
if (lump->lum_magic != cpu_to_le32(LMV_USER_MAGIC)) if (lump->lum_magic != cpu_to_le32(LMV_USER_MAGIC))
lustre_swab_lmv_user_md(lump); lustre_swab_lmv_user_md(lump);
mode = (~current_umask() & 0755) | S_IFDIR; if (!IS_POSIXACL(parent) || !exp_connect_umask(ll_i2mdexp(parent)))
op_data = ll_prep_md_op_data(NULL, dir, NULL, filename, mode &= ~current_umask();
strlen(filename), mode, LUSTRE_OPC_MKDIR, mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
op_data = ll_prep_md_op_data(NULL, parent, NULL, dirname,
strlen(dirname), mode, LUSTRE_OPC_MKDIR,
lump); lump);
if (IS_ERR(op_data)) { if (IS_ERR(op_data)) {
err = PTR_ERR(op_data); err = PTR_ERR(op_data);
...@@ -1379,6 +1391,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1379,6 +1391,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
char *filename; char *filename;
int namelen = 0; int namelen = 0;
int lumlen = 0; int lumlen = 0;
umode_t mode;
int len; int len;
int rc; int rc;
...@@ -1412,11 +1425,12 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1412,11 +1425,12 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
goto lmv_out_free; goto lmv_out_free;
} }
/** #if OBD_OCD_VERSION(2, 9, 50, 0) > LUSTRE_VERSION_CODE
* ll_dir_setdirstripe will be used to set dir stripe mode = data->ioc_type != 0 ? data->ioc_type : S_IRWXUGO;
* mdc_create--->mdt_reint_create (with dirstripe) #else
*/ mode = data->ioc_type;
rc = ll_dir_setdirstripe(inode, lum, filename); #endif
rc = ll_dir_setdirstripe(inode, lum, filename, mode);
lmv_out_free: lmv_out_free:
obd_ioctl_freedata(buf, len); obd_ioctl_freedata(buf, len);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment