diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/llite')
18 files changed, 60 insertions, 80 deletions
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 966f580..38f8466 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -126,6 +126,7 @@ static int ll_ddelete(const struct dentry *de) static int ll_d_init(struct dentry *de) { struct ll_dentry_data *lld = kzalloc(sizeof(*lld), GFP_KERNEL); + if (unlikely(!lld)) return -ENOMEM; lld->lld_invalid = 1; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 481c0d0..67c4b9c 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -116,13 +116,13 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data, * If \a bias is MDS_CLOSE_LAYOUT_SWAP then \a data is a pointer to the inode to * swap layouts with. */ -static int ll_close_inode_openhandle(struct obd_export *md_exp, +static int ll_close_inode_openhandle(struct inode *inode, struct obd_client_handle *och, - struct inode *inode, enum mds_op_bias bias, void *data) { const struct ll_inode_info *lli = ll_i2info(inode); + struct obd_export *md_exp = ll_i2mdexp(inode); struct md_op_data *op_data; struct ptlrpc_request *req = NULL; int rc; @@ -231,15 +231,13 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode) /* There might be a race and this handle may already * be closed. */ - rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, - och, inode, 0, NULL); + rc = ll_close_inode_openhandle(inode, och, 0, NULL); } return rc; } -static int ll_md_close(struct obd_export *md_exp, struct inode *inode, - struct file *file) +static int ll_md_close(struct inode *inode, struct file *file) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct ll_inode_info *lli = ll_i2info(inode); @@ -270,8 +268,7 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, } if (fd->fd_och) { - rc = ll_close_inode_openhandle(md_exp, fd->fd_och, inode, 0, - NULL); + rc = ll_close_inode_openhandle(inode, fd->fd_och, 0, NULL); fd->fd_och = NULL; goto out; } @@ -296,7 +293,7 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, } mutex_unlock(&lli->lli_och_mutex); - if (!md_lock_match(md_exp, flags, ll_inode2fid(inode), + if (!md_lock_match(ll_i2mdexp(inode), flags, ll_inode2fid(inode), LDLM_IBITS, &policy, lockmode, &lockh)) rc = ll_md_real_close(inode, fd->fd_omode); @@ -345,7 +342,7 @@ int ll_file_release(struct inode *inode, struct file *file) lli->lli_async_rc = 0; } - rc = ll_md_close(sbi->ll_md_exp, inode, file); + rc = ll_md_close(inode, file); if (CFS_FAIL_TIMEOUT_MS(OBD_FAIL_PTLRPC_DUMP_LOG, cfs_fail_val)) libcfs_debug_dumplog(); @@ -835,7 +832,7 @@ out_close: it.it_lock_mode = 0; och->och_lease_handle.cookie = 0ULL; } - rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, och, inode, 0, NULL); + rc2 = ll_close_inode_openhandle(inode, och, 0, NULL); if (rc2 < 0) CERROR("%s: error closing file "DFID": %d\n", ll_get_fsname(inode->i_sb, NULL, 0), @@ -901,8 +898,8 @@ static int ll_swap_layouts_close(struct obd_client_handle *och, * NB: lease lock handle is released in mdc_close_layout_swap_pack() * because we still need it to pack l_remote_handle to MDT. */ - rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, och, inode, - MDS_CLOSE_LAYOUT_SWAP, inode2); + rc = ll_close_inode_openhandle(inode, och, MDS_CLOSE_LAYOUT_SWAP, + inode2); och = NULL; /* freed in ll_close_inode_openhandle() */ @@ -937,8 +934,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, if (lease_broken) *lease_broken = cancelled; - return ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, - och, inode, 0, NULL); + return ll_close_inode_openhandle(inode, och, 0, NULL); } int ll_merge_attr(const struct lu_env *env, struct inode *inode) @@ -1159,7 +1155,7 @@ static ssize_t ll_file_read_iter(struct kiocb *iocb, struct iov_iter *to) struct lu_env *env; struct vvp_io_args *args; ssize_t result; - int refcheck; + u16 refcheck; env = cl_env_get(&refcheck); if (IS_ERR(env)) @@ -1183,7 +1179,7 @@ static ssize_t ll_file_write_iter(struct kiocb *iocb, struct iov_iter *from) struct lu_env *env; struct vvp_io_args *args; ssize_t result; - int refcheck; + u16 refcheck; env = cl_env_get(&refcheck); if (IS_ERR(env)) @@ -1340,7 +1336,7 @@ static int ll_file_getstripe(struct inode *inode, struct lov_user_md __user *lum) { struct lu_env *env; - int refcheck; + u16 refcheck; int rc; env = cl_env_get(&refcheck); @@ -1494,8 +1490,7 @@ int ll_release_openhandle(struct inode *inode, struct lookup_intent *it) ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och); - rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, - och, inode, 0, NULL); + rc = ll_close_inode_openhandle(inode, och, 0, NULL); out: /* this one is in place of ll_file_open */ if (it_disposition(it, DISP_ENQ_OPEN_REF)) { @@ -1517,7 +1512,7 @@ static int ll_do_fiemap(struct inode *inode, struct fiemap *fiemap, { struct ll_fiemap_info_key fmkey = { .lfik_name = KEY_FIEMAP, }; struct lu_env *env; - int refcheck; + u16 refcheck; int rc = 0; /* Checks for fiemap flags */ @@ -1623,7 +1618,7 @@ int ll_data_version(struct inode *inode, __u64 *data_version, int flags) struct cl_object *obj = ll_i2info(inode)->lli_clob; struct lu_env *env; struct cl_io *io; - int refcheck; + u16 refcheck; int result; /* If no file object initialized, we consider its version is 0. */ @@ -1668,7 +1663,7 @@ int ll_hsm_release(struct inode *inode) struct obd_client_handle *och = NULL; __u64 data_version = 0; int rc; - int refcheck; + u16 refcheck; CDEBUG(D_INODE, "%s: Releasing file "DFID".\n", ll_get_fsname(inode->i_sb, NULL, 0), @@ -1698,8 +1693,8 @@ int ll_hsm_release(struct inode *inode) * NB: lease lock handle is released in mdc_hsm_release_pack() because * we still need it to pack l_remote_handle to MDT. */ - rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, och, inode, - MDS_HSM_RELEASE, &data_version); + rc = ll_close_inode_openhandle(inode, och, MDS_HSM_RELEASE, + &data_version); och = NULL; out: @@ -2324,7 +2319,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, struct cl_io *io; struct cl_fsync_io *fio; int result; - int refcheck; + u16 refcheck; if (mode != CL_FSYNC_NONE && mode != CL_FSYNC_LOCAL && mode != CL_FSYNC_DISCARD && mode != CL_FSYNC_ALL) @@ -3272,7 +3267,7 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf) struct cl_object *obj = lli->lli_clob; struct lu_env *env; int rc; - int refcheck; + u16 refcheck; if (!obj) return 0; diff --git a/drivers/staging/lustre/lustre/llite/glimpse.c b/drivers/staging/lustre/lustre/llite/glimpse.c index 504498d..0143112 100644 --- a/drivers/staging/lustre/lustre/llite/glimpse.c +++ b/drivers/staging/lustre/lustre/llite/glimpse.c @@ -138,7 +138,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, } static int cl_io_get(struct inode *inode, struct lu_env **envout, - struct cl_io **ioout, int *refcheck) + struct cl_io **ioout, u16 *refcheck) { struct lu_env *env; struct cl_io *io; @@ -178,7 +178,7 @@ int cl_glimpse_size0(struct inode *inode, int agl) struct lu_env *env = NULL; struct cl_io *io = NULL; int result; - int refcheck; + u16 refcheck; result = cl_io_get(inode, &env, &io, &refcheck); if (result > 0) { diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c b/drivers/staging/lustre/lustre/llite/lcommon_cl.c index f1036f4..8af6110 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_cl.c @@ -72,7 +72,7 @@ * mutex. */ struct lu_env *cl_inode_fini_env; -int cl_inode_fini_refcheck; +u16 cl_inode_fini_refcheck; /** * A mutex serializing calls to slp_inode_fini() under extreme memory @@ -86,7 +86,7 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, struct lu_env *env; struct cl_io *io; int result; - int refcheck; + u16 refcheck; env = cl_env_get(&refcheck); if (IS_ERR(env)) @@ -149,7 +149,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) } }; int result = 0; - int refcheck; + u16 refcheck; LASSERT(md->body->mbo_valid & OBD_MD_FLID); LASSERT(S_ISREG(inode->i_mode)); @@ -237,7 +237,7 @@ void cl_inode_fini(struct inode *inode) struct lu_env *env; struct ll_inode_info *lli = ll_i2info(inode); struct cl_object *clob = lli->lli_clob; - int refcheck; + u16 refcheck; int emergency; if (clob) { diff --git a/drivers/staging/lustre/lustre/llite/lcommon_misc.c b/drivers/staging/lustre/lustre/llite/lcommon_misc.c index f0c132e..7f7f3f1 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_misc.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_misc.c @@ -124,7 +124,7 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, struct cl_lock *lock; struct cl_lock_descr *descr; __u32 enqflags; - int refcheck; + u16 refcheck; int rc; env = cl_env_get(&refcheck); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 55f68ac..d2a0fab 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -35,7 +35,6 @@ #include "../include/lustre_debug.h" #include "../include/lustre_ver.h" #include "../include/lustre_disk.h" /* for s2sbi */ -#include "../include/lustre_eacl.h" #include "../include/lustre_linkea.h" /* for struct cl_lock_descr and struct cl_io */ @@ -1330,7 +1329,7 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, unsigned int attr_flags); extern struct lu_env *cl_inode_fini_env; -extern int cl_inode_fini_refcheck; +extern u16 cl_inode_fini_refcheck; int cl_file_inode_init(struct inode *inode, struct lustre_md *md); void cl_inode_fini(struct inode *inode); diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index d483c44..11b5a8d 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1486,8 +1486,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) goto out; } - op_data->op_attr = *attr; - if (!hsm_import && attr->ia_valid & ATTR_SIZE) { /* * If we are changing file size, file content is @@ -1495,8 +1493,11 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) */ attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; op_data->op_bias |= MDS_DATA_MODIFIED; + clear_bit(LLIF_DATA_MODIFIED, &lli->lli_flags); } + op_data->op_attr = *attr; + rc = ll_md_setattr(dentry, op_data); if (rc) goto out; @@ -1542,8 +1543,15 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) int rc2; rc2 = ll_hsm_state_set(inode, &hss); + /* + * truncate and write can happen at the same time, so that + * the file can be set modified even though the file is not + * restored from released state, and ll_hsm_state_set() is + * not applicable for the file, and rc2 < 0 is normal in this + * case. + */ if (rc2 < 0) - CERROR(DFID "HSM set dirty failed: rc2 = %d\n", + CDEBUG(D_INFO, DFID "HSM set dirty failed: rc2 = %d\n", PFID(ll_inode2fid(inode)), rc2); } @@ -2486,7 +2494,7 @@ no_kbuf: void ll_compute_rootsquash_state(struct ll_sb_info *sbi) { struct root_squash_info *squash = &sbi->ll_squash; - lnet_process_id_t id; + struct lnet_process_id id; bool matched; int i; diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 896196c..cbbfdaf 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -150,7 +150,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, struct cl_io *io; struct vvp_io *vio; int result; - int refcheck; + u16 refcheck; sigset_t set; struct inode *inode; struct ll_inode_info *lli; @@ -268,7 +268,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) unsigned long ra_flags; int result = 0; int fault_ret = 0; - int refcheck; + u16 refcheck; env = cl_env_get(&refcheck); if (IS_ERR(env)) diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index f3ee584..c742cba 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -386,7 +386,7 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, struct lu_env *env; long diff = 0; long nrpages = 0; - int refcheck; + u16 refcheck; long pages_number; int mult; long rc; @@ -1308,7 +1308,7 @@ static void ll_display_extents_info(struct ll_rw_extents_info *io_extents, r, pct(r, read_tot), pct(read_cum, read_tot), w, pct(w, write_tot), pct(write_cum, write_tot)); start = end; - if (start == 1 << 10) { + if (start == 1024) { start = 1; units += 10; unitp++; diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index fc17654..d583696 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -434,6 +434,7 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) { if (inode) { struct dentry *new = ll_find_alias(inode, de); + if (new) { d_move(new, de); iput(inode); diff --git a/drivers/staging/lustre/lustre/llite/range_lock.c b/drivers/staging/lustre/lustre/llite/range_lock.c index 14148a0..161391b 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.c +++ b/drivers/staging/lustre/lustre/llite/range_lock.c @@ -174,7 +174,7 @@ void range_unlock(struct range_lock_tree *tree, struct range_lock *lock) */ static enum interval_iter range_lock_cb(struct interval_node *node, void *arg) { - struct range_lock *lock = (struct range_lock *)arg; + struct range_lock *lock = arg; struct range_lock *overlap = node2rangelock(node); lock->rl_blocking_ranges += overlap->rl_lock_count + 1; diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 50d027e..1bac51f 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -905,7 +905,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc) bool redirtied = false; bool unlocked = false; int result; - int refcheck; + u16 refcheck; LASSERT(PageLocked(vmpage)); LASSERT(!PageWriteback(vmpage)); diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index d89e795..420f296 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -156,32 +156,6 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask) #define MAX_DIRECTIO_SIZE (2 * 1024 * 1024 * 1024UL) -static inline int ll_get_user_pages(int rw, unsigned long user_addr, - size_t size, struct page ***pages, - int *max_pages) -{ - int result = -ENOMEM; - - /* set an arbitrary limit to prevent arithmetic overflow */ - if (size > MAX_DIRECTIO_SIZE) { - *pages = NULL; - return -EFBIG; - } - - *max_pages = (user_addr + size + PAGE_SIZE - 1) >> PAGE_SHIFT; - *max_pages -= user_addr >> PAGE_SHIFT; - - *pages = libcfs_kvzalloc(*max_pages * sizeof(**pages), GFP_NOFS); - if (*pages) { - result = get_user_pages_fast(user_addr, *max_pages, - (rw == READ), *pages); - if (unlikely(result <= 0)) - kvfree(*pages); - } - - return result; -} - /* ll_free_user_pages - tear down page struct array * @pages: array of page struct pointers underlying target buffer */ diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 4759802..56f4b10 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -84,7 +84,7 @@ MODULE_ALIAS_FS("lustre"); static int __init lustre_init(void) { - lnet_process_id_t lnet_id; + struct lnet_process_id lnet_id; struct timespec64 ts; int i, rc, seed[2]; diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index cd77b55..60aac42 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -129,6 +129,7 @@ static const char *ll_get_link(struct dentry *dentry, struct ptlrpc_request *request = NULL; int rc; char *symname = NULL; + if (!dentry) return ERR_PTR(-ECHILD); diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 3669ea7..6cb2db2 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -313,7 +313,7 @@ int cl_sb_init(struct super_block *sb) struct cl_device *cl; struct lu_env *env; int rc = 0; - int refcheck; + u16 refcheck; sbi = ll_s2sbi(sb); env = cl_env_get(&refcheck); @@ -336,7 +336,7 @@ int cl_sb_fini(struct super_block *sb) struct ll_sb_info *sbi; struct lu_env *env; struct cl_device *cld; - int refcheck; + u16 refcheck; int result; sbi = ll_s2sbi(sb); @@ -535,7 +535,7 @@ static int vvp_pgcache_show(struct seq_file *f, void *v) struct cl_object *clob; struct lu_env *env; struct vvp_pgcache_id id; - int refcheck; + u16 refcheck; int result; env = cl_env_get(&refcheck); @@ -584,7 +584,7 @@ static void *vvp_pgcache_start(struct seq_file *f, loff_t *pos) { struct ll_sb_info *sbi; struct lu_env *env; - int refcheck; + u16 refcheck; sbi = f->private; @@ -608,7 +608,7 @@ static void *vvp_pgcache_next(struct seq_file *f, void *v, loff_t *pos) { struct ll_sb_info *sbi; struct lu_env *env; - int refcheck; + u16 refcheck; env = cl_env_get(&refcheck); if (!IS_ERR(env)) { diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 4c57755..aa31bc0 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -219,6 +219,7 @@ static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io, if (vio->vui_fd && (vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) { descr->cld_mode = CLM_GROUP; descr->cld_gid = vio->vui_fd->fd_grouplock.lg_gid; + enqflags |= CEF_LOCK_MATCH; } else { descr->cld_mode = mode; } @@ -449,6 +450,7 @@ static void vvp_io_advance(const struct lu_env *env, { struct cl_object *obj = ios->cis_io->ci_obj; struct vvp_io *vio = cl2vvp_io(env, ios); + CLOBINVRNT(env, obj, vvp_object_invariant(obj)); vio->vui_tot_count -= nob; diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 421cc04..6187bff 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -40,7 +40,6 @@ #include "../include/obd_support.h" #include "../include/lustre_dlm.h" #include "../include/lustre_ver.h" -#include "../include/lustre_eacl.h" #include "llite_internal.h" @@ -427,7 +426,7 @@ static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) .cl_buf.lb_len = buf_size, }; struct lu_env *env; - int refcheck; + u16 refcheck; if (!obj) return -ENODATA; |