Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-13636 osd: create agent inode with explicit owner
[fs/lustre-release.git]
/
lustre
/
osd-ldiskfs
/
osd_handler.c
diff --git
a/lustre/osd-ldiskfs/osd_handler.c
b/lustre/osd-ldiskfs/osd_handler.c
index
269e430
..
c561425
100644
(file)
--- a/
lustre/osd-ldiskfs/osd_handler.c
+++ b/
lustre/osd-ldiskfs/osd_handler.c
@@
-957,8
+957,7
@@
static int osd_check_lmv(struct osd_thread_info *oti, struct osd_device *dev,
{
struct lu_buf *buf = &oti->oti_big_buf;
struct dentry *dentry = &oti->oti_obj_dentry;
- struct file *filp = &oti->oti_file;
- const struct file_operations *fops;
+ struct file *filp;
struct lmv_mds_md_v1 *lmv1;
struct osd_check_lmv_buf oclb = {
.ctx.actor = osd_stripe_dir_filldir,
@@
-1003,18
+1002,7
@@
again:
if (le32_to_cpu(lmv1->lmv_magic) != LMV_MAGIC_V1)
GOTO(out, rc = 0);
- fops = inode->i_fop;
- dentry->d_inode = inode;
- dentry->d_sb = inode->i_sb;
- filp->f_pos = 0;
- filp->f_path.dentry = dentry;
- filp->f_flags |= O_NOATIME;
- filp->f_mode = FMODE_64BITHASH | FMODE_NONOTIFY;
- filp->f_mapping = inode->i_mapping;
- filp->f_op = fops;
- filp->private_data = NULL;
- filp->f_cred = current_cred();
- filp->f_inode = inode;
+ filp = osd_quasi_file(oti->oti_env, inode);
rc = osd_security_file_alloc(filp);
if (rc)
goto out;
@@
-1024,7
+1012,7
@@
again:
rc = iterate_dir(filp, &oclb.ctx);
} while (rc >= 0 && oclb.oclb_items > 0 && !oclb.oclb_found &&
filp->f_pos != LDISKFS_HTREE_EOF_64BIT);
-
fops
->release(inode, filp);
+
inode->i_fop
->release(inode, filp);
out:
if (rc < 0)
@@
-1179,17
+1167,19
@@
trigger:
}
}
- if (
thread_is_running(&scrub->os_thread)
) {
+ if (
scrub->os_running
) {
if (scrub->os_partial_scan && !scrub->os_in_join)
goto join;
- if (IS_ERR_OR_NULL(inode) || result)
+ osd_add_oi_cache(info, dev, id, fid);
+ if (IS_ERR_OR_NULL(inode) || result) {
+ osd_oii_insert(dev, oic, result == -ENOENT);
GOTO(out, result = -EINPROGRESS);
+ }
LASSERT(remote);
LASSERT(obj->oo_inode == inode);
- osd_add_oi_cache(info, dev, id, fid);
osd_oii_insert(dev, oic, true);
goto found;
}
@@
-1212,13
+1202,15
@@
join:
if (rc1 && rc1 != -EALREADY)
GOTO(out, result = -EREMCHG);
- if (IS_ERR_OR_NULL(inode) || result)
+ osd_add_oi_cache(info, dev, id, fid);
+ if (IS_ERR_OR_NULL(inode) || result) {
+ osd_oii_insert(dev, oic, result == -ENOENT);
GOTO(out, result = -EINPROGRESS);
+ }
LASSERT(remote);
LASSERT(obj->oo_inode == inode);
- osd_add_oi_cache(info, dev, id, fid);
osd_oii_insert(dev, oic, true);
goto found;
@@
-1591,11
+1583,8
@@
static void osd_object_free(const struct lu_env *env, struct lu_object *l)
ldiskfs_htree_lock_head_free(obj->oo_hl_head);
/* obj doesn't contain an lu_object_header, so we don't need call_rcu */
OBD_FREE_PTR(obj);
- if (unlikely(h)) {
- lu_object_header_fini(h);
- OBD_FREE_PRE(h, sizeof(*h), "kfreed");
- kfree_rcu(h, loh_rcu);
- }
+ if (unlikely(h))
+ lu_object_header_free(h);
}
/*
@@
-1617,16
+1606,6
@@
static void osd_index_fini(struct osd_object *o)
}
}
-/*
- * Concurrency: no concurrent access is possible that late in object
- * life-cycle (for all existing callers, that is. New callers have to provide
- * their own locking.)
- */
-static int osd_inode_unlinked(const struct inode *inode)
-{
- return inode->i_nlink == 0;
-}
-
enum {
OSD_TXN_OI_DELETE_CREDITS = 20,
OSD_TXN_INODE_DELETE_CREDITS = 20
@@
-2913,6
+2892,13
@@
static int osd_inode_setattr(const struct lu_env *env,
/* always keep S_NOCMTIME */
inode->i_flags = ll_ext_to_inode_flags(attr->la_flags) |
S_NOCMTIME;
+#if defined(S_ENCRYPTED)
+ /* Always remove S_ENCRYPTED, because ldiskfs must not be
+ * aware of encryption status. It is just stored into LMA
+ * so that it can be forwared to client side.
+ */
+ inode->i_flags &= ~S_ENCRYPTED;
+#endif
/*
* Ext4 did not transfer inherit flags from
* @inode->i_flags to raw inode i_flags when writing
@@
-2960,9
+2946,9
@@
static int osd_transfer_project(struct inode *inode, __u32 projid,
raw_inode = ldiskfs_raw_inode(&iloc);
if (!LDISKFS_FITS_IN_INODE(raw_inode, ei, i_projid)) {
- struct osd_thandle *oh =
-
container_of0(handle,
struct osd_thandle,
- ot_super);
+ struct osd_thandle *oh =
container_of(handle,
+
struct osd_thandle,
+
ot_super);
/**
* try to expand inode size automatically.
*/
@@
-3661,8
+3647,10
@@
static int osd_destroy(const struct lu_env *env, struct dt_object *dt,
}
if (S_ISDIR(inode->i_mode)) {
- LASSERT(osd_inode_unlinked(inode) || inode->i_nlink == 1 ||
- inode->i_nlink == 2);
+ if (inode->i_nlink > 2)
+ CERROR("%s: directory "DFID" ino %lu link count is %u at unlink. run e2fsck to repair\n",
+ osd_name(osd), PFID(fid), inode->i_ino,
+ inode->i_nlink);
spin_lock(&obj->oo_guard);
clear_nlink(inode);
@@
-3866,6
+3854,7
@@
static struct inode *osd_create_local_agent_inode(const struct lu_env *env,
struct osd_thread_info *info = osd_oti_get(env);
struct inode *local;
struct osd_thandle *oh;
+ uid_t own[2] = {0, 0};
int rc;
ENTRY;
@@
-3874,8
+3863,7
@@
static struct inode *osd_create_local_agent_inode(const struct lu_env *env,
oh = container_of(th, struct osd_thandle, ot_super);
LASSERT(oh->ot_handle->h_transaction != NULL);
- local = ldiskfs_create_inode(oh->ot_handle, pobj->oo_inode, type,
- NULL);
+ local = ldiskfs_create_inode(oh->ot_handle, pobj->oo_inode, type, own);
if (IS_ERR(local)) {
CERROR("%s: create local error %d\n", osd_name(osd),
(int)PTR_ERR(local));
@@
-4210,6
+4198,9
@@
static int osd_ref_del(const struct lu_env *env, struct dt_object *dt,
LASSERT(osd_is_write_locked(env, obj));
LASSERT(th != NULL);
+ if (OBD_FAIL_CHECK(OBD_FAIL_OSD_REF_DEL))
+ return -EIO;
+
oh = container_of(th, struct osd_thandle, ot_super);
LASSERT(oh->ot_handle != NULL);
@@
-4824,20
+4815,11
@@
static int osd_object_sync(const struct lu_env *env, struct dt_object *dt,
{
struct osd_object *obj = osd_dt_obj(dt);
struct inode *inode = obj->oo_inode;
- struct osd_thread_info *info = osd_oti_get(env);
- struct dentry *dentry = &info->oti_obj_dentry;
- struct file *file = &info->oti_file;
+ struct file *file = osd_quasi_file(env, inode);
int rc;
ENTRY;
- dentry->d_inode = inode;
- dentry->d_sb = inode->i_sb;
- file->f_path.dentry = dentry;
- file->f_mapping = inode->i_mapping;
- file->f_op = inode->i_fop;
- file->f_inode = inode;
-
rc = vfs_fsync_range(file, start, end, 0);
RETURN(rc);
@@
-5669,8
+5651,7
@@
osd_consistency_check(struct osd_thread_info *oti, struct osd_device *dev,
if (!fid_is_norm(fid) && !fid_is_igif(fid))
RETURN(0);
- if (thread_is_running(&scrub->os_thread) &&
- scrub->os_pos_current > id->oii_ino)
+ if (scrub->os_running && scrub->os_pos_current > id->oii_ino)
RETURN(0);
if (dev->od_auto_scrub_interval == AS_NEVER ||
@@
-5711,7
+5692,7
@@
again:
insert = false;
trigger:
- if (
thread_is_running(&scrub->os_thread)
) {
+ if (
scrub->os_running
) {
if (inode == NULL) {
inode = osd_iget(oti, dev, id);
/* The inode has been removed (by race maybe). */
@@
-7293,8
+7274,6
@@
static inline int osd_it_ea_rec(const struct lu_env *env,
rc = osd_ea_fid_get(env, obj, ino, fid, id);
}
- } else {
- osd_id_gen(id, ino, OSD_OII_NOGEN);
}
}
@@
-7304,15
+7283,6
@@
static inline int osd_it_ea_rec(const struct lu_env *env,
it->oie_dirent->oied_namelen,
it->oie_dirent->oied_type, attr);
- if (rc < 0)
- RETURN(rc);
-
- if (osd_remote_fid(env, dev, fid))
- RETURN(0);
-
- if (likely(!(attr & (LUDA_IGNORE | LUDA_UNKNOWN)) && rc == 0))
- osd_add_oi_cache(oti, dev, id, fid);
-
RETURN(rc > 0 ? 0 : rc);
}