X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Ffile.c;h=73c256ce94bd9b0d3bca6312592fcaeec8fb137b;hp=4b19afb0ee073f2ceb1c6710404df839b6a277e1;hb=6bceb0030d15b70097d75f8da2d373310fe2c658;hpb=0feec5a3c7d4518d5c563739124b202a6a0a99f7 diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 4b19afb..73c256c 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -46,7 +46,6 @@ #include #include -#include #include #include "cl_object.h" @@ -172,7 +171,7 @@ static int ll_close_inode_openhandle(struct inode *inode, op_data->op_attr_blocks += ((struct inode *)data)->i_blocks; op_data->op_attr.ia_valid |= ATTR_SIZE; op_data->op_xvalid |= OP_XVALID_BLOCKS; - /* fallthrough */ + fallthrough; case MDS_CLOSE_LAYOUT_SPLIT: case MDS_CLOSE_LAYOUT_SWAP: { struct split_param *sp = data; @@ -444,11 +443,15 @@ out: static inline int ll_dom_readpage(void *data, struct page *page) { + /* since ll_dom_readpage is a page cache helper, it is safe to assume + * mapping and host pointers are set here + */ + struct inode *inode; struct niobuf_local *lnb = data; void *kaddr; int rc = 0; - struct inode *inode = page2inode(page); + inode = page2inode(page); kaddr = kmap_atomic(page); memcpy(kaddr, lnb->lnb_data, lnb->lnb_len); @@ -591,7 +594,7 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req) put_page(vmpage); break; } - cl_page_export(env, page, 1); + SetPageUptodate(vmpage); cl_page_put(env, page); unlock_page(vmpage); put_page(vmpage); @@ -1574,6 +1577,12 @@ void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot, #endif } +#ifdef IOCB_NOWAIT + io->ci_iocb_nowait = !!(args && + (args->u.normal.via_iocb->ki_flags & + IOCB_NOWAIT)); +#endif + io->ci_obj = ll_i2info(inode)->lli_clob; io->ci_lockreq = CILR_MAYBE; if (ll_file_nolock(file)) { @@ -1660,6 +1669,8 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, io = vvp_env_thread_io(env); if (file->f_flags & O_DIRECT) { + if (file->f_flags & O_APPEND) + dio_lock = 1; if (!is_sync_kiocb(args->u.normal.via_iocb)) is_aio = true; @@ -1996,6 +2007,12 @@ out: ktime_us_delta(ktime_get(), kstart)); } + CDEBUG(D_IOTRACE, + "COMPLETED: file %s:"DFID", ppos: %lld, count: %zu\n", + file_dentry(file)->d_name.name, + PFID(ll_inode2fid(file_inode(file))), iocb->ki_pos, + iov_iter_count(to)); + RETURN(result); } @@ -2139,6 +2156,12 @@ out: ktime_us_delta(ktime_get(), kstart)); } + CDEBUG(D_IOTRACE, + "COMPLETED: file %s:"DFID", ppos: %lld, count: %zu\n", + file_dentry(file)->d_name.name, + PFID(ll_inode2fid(file_inode(file))), iocb->ki_pos, + iov_iter_count(from)); + RETURN(rc_normal); } @@ -2751,7 +2774,7 @@ static int ll_do_fiemap(struct inode *inode, struct fiemap *fiemap, GOTO(out, rc); } - fmkey.lfik_oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP; + fmkey.lfik_oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLPROJID; obdo_from_inode(&fmkey.lfik_oa, inode, OBD_MD_FLSIZE); obdo_set_parent_fid(&fmkey.lfik_oa, &ll_i2info(inode)->lli_fid); @@ -2895,8 +2918,9 @@ int ll_hsm_release(struct inode *inode) struct lu_env *env; struct obd_client_handle *och = NULL; __u64 data_version = 0; - int rc; __u16 refcheck; + int rc; + ENTRY; CDEBUG(D_INODE, "%s: Releasing file "DFID".\n", @@ -2908,7 +2932,8 @@ int ll_hsm_release(struct inode *inode) GOTO(out, rc = PTR_ERR(och)); /* Grab latest data_version and [am]time values */ - rc = ll_data_version(inode, &data_version, LL_DV_WR_FLUSH); + rc = ll_data_version(inode, &data_version, + LL_DV_WR_FLUSH | LL_DV_SZ_UPDATE); if (rc != 0) GOTO(out, rc); @@ -3346,7 +3371,7 @@ static int ll_ladvise_sanity(struct inode *inode, ladvise_names[advice], rc); GOTO(out, rc); } - /* fallthrough */ + fallthrough; case LU_LADVISE_WILLREAD: case LU_LADVISE_DONTNEED: default: @@ -3490,12 +3515,14 @@ int ll_ioctl_check_project(struct inode *inode, __u32 xflags, static int ll_set_project(struct inode *inode, __u32 xflags, __u32 projid) { - struct md_op_data *op_data; struct ptlrpc_request *req = NULL; + struct md_op_data *op_data; struct cl_object *obj; unsigned int inode_flags; int rc = 0; + CDEBUG(D_QUOTA, DFID" xflags=%x projid=%u\n", + PFID(ll_inode2fid(inode)), xflags, projid); rc = ll_ioctl_check_project(inode, xflags, projid); if (rc) RETURN(rc); @@ -3509,7 +3536,10 @@ static int ll_set_project(struct inode *inode, __u32 xflags, __u32 projid) op_data->op_attr_flags = ll_inode_to_ext_flags(inode_flags); if (xflags & FS_XFLAG_PROJINHERIT) op_data->op_attr_flags |= LUSTRE_PROJINHERIT_FL; + + /* pass projid to md_op_data */ op_data->op_projid = projid; + op_data->op_xvalid |= OP_XVALID_PROJID | OP_XVALID_FLAGS; rc = md_setattr(ll_i2sbi(inode)->ll_md_exp, op_data, NULL, 0, &req); ptlrpc_req_finished(req); @@ -4037,9 +4067,7 @@ out: RETURN(0); } case OBD_IOC_GETNAME_OLD: - /* fall through */ case OBD_IOC_GETDTNAME: - /* fall through */ case OBD_IOC_GETMDNAME: RETURN(ll_get_obd_name(inode, cmd, arg)); case LL_IOC_HSM_STATE_GET: { @@ -4840,7 +4868,6 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum, __u64 data_version = 0; size_t namelen = strlen(name); int lumlen = lmv_user_md_size(lum->lum_stripe_count, lum->lum_magic); - bool oldformat = false; int rc; ENTRY; @@ -4891,20 +4918,6 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum, if (is_root_inode(child_inode)) GOTO(out_iput, rc = -EINVAL); - if (IS_ENCRYPTED(parent)) { - if (unlikely(!llcrypt_policy_has_filename_enc(parent))) - oldformat = true; - } else if (IS_ENCRYPTED(child_inode) && - unlikely(!llcrypt_policy_has_filename_enc(child_inode))) { - oldformat = true; - } - if (unlikely(oldformat)) { - CDEBUG(D_SEC, - "cannot migrate old format encrypted "DFID", please move to new enc dir first\n", - PFID(ll_inode2fid(child_inode))); - GOTO(out_iput, rc = -EUCLEAN); - } - op_data = ll_prep_md_op_data(NULL, parent, NULL, name, namelen, child_inode->i_mode, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) @@ -5179,12 +5192,14 @@ static int ll_merge_md_attr(struct inode *inode) struct cl_attr attr = { 0 }; int rc; - LASSERT(lli->lli_lsm_md != NULL); - - if (!lmv_dir_striped(lli->lli_lsm_md)) + if (!lli->lli_lsm_md) RETURN(0); down_read(&lli->lli_lsm_sem); + if (!lmv_dir_striped(lli->lli_lsm_md)) { + up_read(&lli->lli_lsm_sem); + RETURN(0); + } rc = md_merge_attr(ll_i2mdexp(inode), ll_i2info(inode)->lli_lsm_md, &attr, ll_md_blocking_ast); up_read(&lli->lli_lsm_sem); @@ -5378,11 +5393,11 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) int cl_falloc(struct file *file, struct inode *inode, int mode, loff_t offset, loff_t len) { + loff_t size = i_size_read(inode); struct lu_env *env; struct cl_io *io; __u16 refcheck; int rc; - loff_t size = i_size_read(inode); ENTRY; @@ -5401,12 +5416,14 @@ int cl_falloc(struct file *file, struct inode *inode, int mode, loff_t offset, io->u.ci_setattr.sa_falloc_end = offset + len; io->u.ci_setattr.sa_subtype = CL_SETATTR_FALLOCATE; - CDEBUG(D_INODE, "UID %u GID %u\n", + CDEBUG(D_INODE, "UID %u GID %u PRJID %u\n", from_kuid(&init_user_ns, inode->i_uid), - from_kgid(&init_user_ns, inode->i_gid)); + from_kgid(&init_user_ns, inode->i_gid), + ll_i2info(inode)->lli_projid); io->u.ci_setattr.sa_falloc_uid = from_kuid(&init_user_ns, inode->i_uid); io->u.ci_setattr.sa_falloc_gid = from_kgid(&init_user_ns, inode->i_gid); + io->u.ci_setattr.sa_falloc_projid = ll_i2info(inode)->lli_projid; if (io->u.ci_setattr.sa_falloc_end > size) { loff_t newsize = io->u.ci_setattr.sa_falloc_end;