#define DEBUG_SUBSYSTEM S_LLITE
#include <lustre_dlm.h>
-#include <lustre_lite.h>
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/sched.h>
op_data->op_attr.ia_ctime = inode->i_ctime;
op_data->op_attr.ia_size = i_size_read(inode);
op_data->op_attr_blocks = inode->i_blocks;
- ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags =
- ll_inode_to_ext_flags(inode->i_flags);
+ op_data->op_attr_flags = ll_inode_to_ext_flags(inode->i_flags);
op_data->op_ioepoch = ll_i2info(inode)->lli_ioepoch;
if (fh)
op_data->op_handle = *fh;
spin_unlock(&lli->lli_lock);
}
- if (rc == 0) {
- rc = ll_objects_destroy(req, inode);
- if (rc)
- CERROR("%s: inode "DFID
- " ll_objects destroy: rc = %d\n",
- ll_i2mdexp(inode)->exp_obd->obd_name,
- PFID(ll_inode2fid(inode)), rc);
- }
-
if (rc == 0 && op_data->op_bias & MDS_HSM_RELEASE) {
struct mdt_body *body;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
struct range_lock range;
ENTRY;
- CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: "LPU64", count: %zd\n",
+ CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: "LPU64", count: %zu\n",
file->f_dentry->d_name.name, iot, *ppos, count);
restart:
/* If any bit been read/written (result != 0), we just return
* short read/write instead of restart io. */
if ((result == 0 || result == -ENODATA) && io->ci_need_restart) {
- CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n",
+ CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zu\n",
iot == CIT_READ ? "read" : "write",
file->f_dentry->d_name.name, *ppos, count);
LASSERTF(io->ci_nob == 0, "%zd\n", io->ci_nob);
RETURN(result);
}
-static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
- obd_count ost_idx)
-{
- struct obd_export *exp = ll_i2dtexp(inode);
- struct obd_trans_info oti = { 0 };
- struct obdo *oa = NULL;
- int lsm_size;
- int rc = 0;
- struct lov_stripe_md *lsm = NULL, *lsm2;
- ENTRY;
-
- OBDO_ALLOC(oa);
- if (oa == NULL)
- RETURN(-ENOMEM);
-
- lsm = ccc_inode_lsm_get(inode);
- if (!lsm_has_objects(lsm))
- GOTO(out, rc = -ENOENT);
-
- lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) *
- (lsm->lsm_stripe_count));
-
- OBD_ALLOC_LARGE(lsm2, lsm_size);
- if (lsm2 == NULL)
- GOTO(out, rc = -ENOMEM);
-
- oa->o_oi = *oi;
- oa->o_nlink = ost_idx;
- oa->o_flags |= OBD_FL_RECREATE_OBJS;
- oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
- obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
- OBD_MD_FLMTIME | OBD_MD_FLCTIME);
- obdo_set_parent_fid(oa, &ll_i2info(inode)->lli_fid);
- memcpy(lsm2, lsm, lsm_size);
- ll_inode_size_lock(inode);
- rc = obd_create(NULL, exp, oa, &lsm2, &oti);
- ll_inode_size_unlock(inode);
-
- OBD_FREE_LARGE(lsm2, lsm_size);
- GOTO(out, rc);
-out:
- ccc_inode_lsm_put(inode, lsm);
- OBDO_FREE(oa);
- return rc;
-}
-
-static int ll_lov_recreate_obj(struct inode *inode, unsigned long arg)
-{
- struct ll_recreate_obj ucreat;
- struct ost_id oi;
- ENTRY;
-
- if (!cfs_capable(CFS_CAP_SYS_ADMIN))
- RETURN(-EPERM);
-
- if (copy_from_user(&ucreat, (struct ll_recreate_obj __user *)arg,
- sizeof(ucreat)))
- RETURN(-EFAULT);
-
- ostid_set_seq_mdt0(&oi);
- ostid_set_id(&oi, ucreat.lrc_id);
- RETURN(ll_lov_recreate(inode, &oi, ucreat.lrc_ost_idx));
-}
-
-static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
-{
- struct lu_fid fid;
- struct ost_id oi;
- obd_count ost_idx;
- ENTRY;
-
- if (!cfs_capable(CFS_CAP_SYS_ADMIN))
- RETURN(-EPERM);
-
- if (copy_from_user(&fid, (struct lu_fid __user *)arg, sizeof(fid)))
- RETURN(-EFAULT);
-
- fid_to_ostid(&fid, &oi);
- ost_idx = (fid_seq(&fid) >> 16) & 0xffff;
- RETURN(ll_lov_recreate(inode, &oi, ost_idx));
-}
-
int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
__u64 flags, struct lov_user_md *lum,
int lum_size)
static int ll_lov_setstripe(struct inode *inode, struct file *file,
unsigned long arg)
{
- struct lov_user_md_v3 lumv3;
- struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&lumv3;
- struct lov_user_md_v1 __user *lumv1p =
- (struct lov_user_md_v1 __user *)arg;
- struct lov_user_md_v3 __user *lumv3p =
- (struct lov_user_md_v3 __user *)arg;
- int lum_size, rc;
- __u64 flags = FMODE_WRITE;
+ struct lov_user_md __user *lum = (struct lov_user_md __user *)arg;
+ struct lov_user_md *klum;
+ int lum_size, rc;
+ __u64 flags = FMODE_WRITE;
ENTRY;
- /* first try with v1 which is smaller than v3 */
- lum_size = sizeof(struct lov_user_md_v1);
- if (copy_from_user(lumv1, lumv1p, lum_size))
- RETURN(-EFAULT);
-
- if (lumv1->lmm_magic == LOV_USER_MAGIC_V3) {
- lum_size = sizeof(struct lov_user_md_v3);
- if (copy_from_user(&lumv3, lumv3p, lum_size))
- RETURN(-EFAULT);
- }
+ rc = ll_copy_user_md(lum, &klum);
+ if (rc < 0)
+ RETURN(rc);
- rc = ll_lov_setstripe_ea_info(inode, file, flags, lumv1, lum_size);
+ lum_size = rc;
+ rc = ll_lov_setstripe_ea_info(inode, file, flags, klum, lum_size);
if (rc == 0) {
struct lov_stripe_md *lsm;
__u32 gen;
- put_user(0, &lumv1p->lmm_stripe_count);
+ put_user(0, &lum->lmm_stripe_count);
ll_layout_refresh(inode, &gen);
lsm = ccc_inode_lsm_get(inode);
rc = obd_iocontrol(LL_IOC_LOV_GETSTRIPE, ll_i2dtexp(inode),
- 0, lsm, (void __user *)arg);
+ 0, lsm, lum);
ccc_inode_lsm_put(inode, lsm);
}
+
+ OBD_FREE(klum, lum_size);
RETURN(rc);
}
int rc;
ENTRY;
+ if (arg == 0) {
+ CWARN("group id for group lock must not be 0\n");
+ RETURN(-EINVAL);
+ }
+
if (ll_file_nolock(file))
RETURN(-EOPNOTSUPP);
RETURN(0);
}
-int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg)
+static int ll_put_grouplock(struct inode *inode, struct file *file,
+ unsigned long arg)
{
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
}
case LL_IOC_LOV_GETSTRIPE:
RETURN(ll_lov_getstripe(inode, arg));
- case LL_IOC_RECREATE_OBJ:
- RETURN(ll_lov_recreate_obj(inode, arg));
- case LL_IOC_RECREATE_FID:
- RETURN(ll_lov_recreate_fid(inode, arg));
case FSFILT_IOC_FIEMAP:
RETURN(ll_ioctl_fiemap(inode, arg));
case FSFILT_IOC_GETFLAGS:
RETURN(0);
}
+ case LL_IOC_GETPARENT:
+ RETURN(ll_getparent(file, (void __user *)arg));
+
case OBD_IOC_FID2PATH:
RETURN(ll_fid2path(inode, (void __user *)arg));
case LL_IOC_DATA_VERSION: {
OBD_FREE(hur, len);
RETURN(rc);
}
-