}
/**
- * \retval +v: new filter_fid, does not contain self-fid
- * \retval 0: filter_fid_old, contains self-fid
+ * \retval +v: new filter_fid does not contain self-fid
+ * \retval 0: filter_fid_18_23, contains self-fid
* \retval -v: other failure cases
*/
int osd_get_idif(struct osd_thread_info *info, struct inode *inode,
struct dentry *dentry, struct lu_fid *fid)
{
- struct filter_fid_old *ff = &info->oti_ff;
+ struct filter_fid *ff = &info->oti_ff;
struct ost_id *ostid = &info->oti_ostid;
int rc;
rc = __osd_xattr_get(inode, dentry, XATTR_NAME_FID, ff, sizeof(*ff));
- if (rc == sizeof(*ff)) {
- rc = 0;
- ostid_set_seq(ostid, le64_to_cpu(ff->ff_seq));
- rc = ostid_set_id(ostid, le64_to_cpu(ff->ff_objid));
+ if (rc == sizeof(struct filter_fid_18_23)) {
+ struct filter_fid_18_23 *ff_old = (void *)ff;
+
+ ostid_set_seq(ostid, le64_to_cpu(ff_old->ff_seq));
+ rc = ostid_set_id(ostid, le64_to_cpu(ff_old->ff_objid));
/*
* XXX: use 0 as the index for compatibility, the caller will
* handle index related issues when necessary.
*/
if (!rc)
ostid_to_fid(fid, ostid, 0);
- } else if (rc == sizeof(struct filter_fid)) {
+ } else if (rc >= (int)sizeof(struct filter_fid_24_29)) {
rc = 1;
} else if (rc >= 0) {
rc = -EINVAL;
if (rc == -ENODATA && !fid_is_igif(rfid) && osd->od_check_ff) {
fid = &lma->lma_self_fid;
rc = osd_get_idif(info, inode, dentry, fid);
- if ((rc > 0) || (rc == -ENODATA && osd->od_index_in_idif)) {
+ if (rc > 0 || (rc == -ENODATA && osd->od_index_in_idif)) {
/*
* For the given OST-object, if it has neither LMA nor
* FID in XATTR_NAME_FID, then the given FID (which is
if (error)
CERROR("transaction @0x%p commit error: %d\n", th, error);
- dt_txn_hook_commit(th);
-
+ OBD_FAIL_TIMEOUT(OBD_FAIL_OST_DELAY_TRANS, 40);
/* call per-transaction callbacks if any */
list_for_each_entry_safe(dcb, tmp, &oh->ot_commit_dcb_list,
dcb_linkage) {
static void osd_object_delete(const struct lu_env *env, struct lu_object *l)
{
struct osd_object *obj = osd_obj(l);
+ struct qsd_instance *qsd = osd_def_qsd(osd_obj2dev(obj));
struct inode *inode = obj->oo_inode;
+ __u64 projid;
+ qid_t uid;
+ qid_t gid;
LINVRNT(osd_invariant(obj));
*/
osd_index_fini(obj);
- if (inode != NULL) {
- struct qsd_instance *qsd = osd_def_qsd(osd_obj2dev(obj));
- qid_t uid = i_uid_read(inode);
- qid_t gid = i_gid_read(inode);
- obj->oo_inode = NULL;
- iput(inode);
- if (!obj->oo_header && qsd) {
- struct osd_thread_info *info = osd_oti_get(env);
- struct lquota_id_info *qi = &info->oti_qi;
+ if (!inode)
+ return;
- /* Release granted quota to master if necessary */
- qi->lqi_id.qid_uid = uid;
- qsd_op_adjust(env, qsd, &qi->lqi_id, USRQUOTA);
+ uid = i_uid_read(inode);
+ gid = i_gid_read(inode);
+ projid = i_projid_read(inode);
- qi->lqi_id.qid_uid = gid;
- qsd_op_adjust(env, qsd, &qi->lqi_id, GRPQUOTA);
+ obj->oo_inode = NULL;
+ iput(inode);
- qi->lqi_id.qid_uid = i_projid_read(inode);
- qsd_op_adjust(env, qsd, &qi->lqi_id, PRJQUOTA);
- }
+ /* do not rebalance quota if the caller needs to release memory
+ * otherwise qsd_refresh_usage() may went into a new ldiskfs
+ * transaction and risk to deadlock - LU-12178 */
+ if (current->flags & (PF_MEMALLOC | PF_KSWAPD))
+ return;
+
+ if (!obj->oo_header && qsd) {
+ struct osd_thread_info *info = osd_oti_get(env);
+ struct lquota_id_info *qi = &info->oti_qi;
+
+ /* Release granted quota to master if necessary */
+ qi->lqi_id.qid_uid = uid;
+ qsd_op_adjust(env, qsd, &qi->lqi_id, USRQUOTA);
+
+ qi->lqi_id.qid_uid = gid;
+ qsd_op_adjust(env, qsd, &qi->lqi_id, GRPQUOTA);
+
+ qi->lqi_id.qid_uid = projid;
+ qsd_op_adjust(env, qsd, &qi->lqi_id, PRJQUOTA);
}
}
#endif
param->ddp_max_ea_size = sb->s_blocksize - ea_overhead;
- if (param->ddp_max_ea_size > OSD_MAX_EA_SIZE)
- param->ddp_max_ea_size = OSD_MAX_EA_SIZE;
+ if (param->ddp_max_ea_size > OBD_MAX_EA_SIZE - ea_overhead)
+ param->ddp_max_ea_size = OBD_MAX_EA_SIZE - ea_overhead;
/*
* Preferred RPC size for efficient disk IO. 4MB shows good
}
}
+static struct super_block *osd_mnt_sb_get(const struct dt_device *d)
+{
+ return osd_sb(osd_dt_dev(d));
+}
+
/*
* Concurrency: shouldn't matter.
*/
.dt_trans_stop = osd_trans_stop,
.dt_trans_cb_add = osd_trans_cb_add,
.dt_conf_get = osd_conf_get,
+ .dt_mnt_sb_get = osd_mnt_sb_get,
.dt_sync = osd_sync,
.dt_ro = osd_ro,
.dt_commit_async = osd_commit_async,
LA_PROJID | LA_FLAGS | LA_NLINK | LA_RDEV |
LA_BLKSIZE | LA_TYPE;
- attr->la_atime = LTIME_S(inode->i_atime);
- attr->la_mtime = LTIME_S(inode->i_mtime);
- attr->la_ctime = LTIME_S(inode->i_ctime);
+ attr->la_atime = inode->i_atime.tv_sec;
+ attr->la_mtime = inode->i_mtime.tv_sec;
+ attr->la_ctime = inode->i_ctime.tv_sec;
attr->la_mode = inode->i_mode;
attr->la_size = i_size_read(inode);
attr->la_blocks = inode->i_blocks;
attr->la_flags |= LUSTRE_PROJINHERIT_FL;
}
-static int osd_attr_get(const struct lu_env *env,
- struct dt_object *dt,
+static int osd_attr_get(const struct lu_env *env, struct dt_object *dt,
struct lu_attr *attr)
{
struct osd_object *obj = osd_dt_obj(dt);
spin_lock(&obj->oo_guard);
osd_inode_getattr(env, obj->oo_inode, attr);
- if (obj->oo_lma_flags & LUSTRE_ORPHAN_FL)
+ if (obj->oo_lma_flags & LUSTRE_ORPHAN_FL) {
+ attr->la_valid |= LA_FLAGS;
attr->la_flags |= LUSTRE_ORPHAN_FL;
+ }
spin_unlock(&obj->oo_guard);
return 0;
static int osd_mkfile(struct osd_thread_info *info, struct osd_object *obj,
umode_t mode, struct dt_allocation_hint *hint,
- struct thandle *th)
+ struct thandle *th, struct lu_attr *attr)
{
int result;
struct osd_device *osd = osd_obj2dev(obj);
struct osd_thandle *oth;
struct dt_object *parent = NULL;
struct inode *inode;
+ uid_t owner[2] = {0, 0};
+
+ if (attr->la_valid & LA_UID)
+ owner[0] = attr->la_uid;
+ if (attr->la_valid & LA_GID)
+ owner[1] = attr->la_gid;
LINVRNT(osd_invariant(obj));
LASSERT(obj->oo_inode == NULL);
inode = ldiskfs_create_inode(oth->ot_handle,
parent ? osd_dt_obj(parent)->oo_inode :
osd_sb(osd)->s_root->d_inode,
- mode);
+ mode, owner);
if (!IS_ERR(inode)) {
/* Do not update file c/mtime in ldiskfs. */
inode->i_flags |= S_NOCMTIME;
oth = container_of(th, struct osd_thandle, ot_super);
LASSERT(oth->ot_handle->h_transaction != NULL);
- result = osd_mkfile(info, obj, mode, hint, th);
+ result = osd_mkfile(info, obj, mode, hint, th, attr);
return result;
}
oth = container_of(th, struct osd_thandle, ot_super);
LASSERT(oth->ot_handle->h_transaction != NULL);
- result = osd_mkfile(info, obj, mode, hint, th);
+ result = osd_mkfile(info, obj, mode, hint, th, attr);
if (result == 0) {
LASSERT(obj->oo_inode != NULL);
if (feat->dif_flags & DT_IND_VARKEY)
{
LASSERT(S_ISREG(attr->la_mode));
return osd_mkfile(info, obj, (attr->la_mode &
- (S_IFMT | S_IALLUGO | S_ISVTX)), hint, th);
+ (S_IFMT | S_IALLUGO | S_ISVTX)), hint, th,
+ attr);
}
static int osd_mksym(struct osd_thread_info *info, struct osd_object *obj,
{
LASSERT(S_ISLNK(attr->la_mode));
return osd_mkfile(info, obj, (attr->la_mode &
- (S_IFMT | S_IALLUGO | S_ISVTX)), hint, th);
+ (S_IFMT | S_IALLUGO | S_ISVTX)), hint, th,
+ attr);
}
static int osd_mknod(struct osd_thread_info *info, struct osd_object *obj,
LASSERT(S_ISCHR(mode) || S_ISBLK(mode) ||
S_ISFIFO(mode) || S_ISSOCK(mode));
- result = osd_mkfile(info, obj, mode, hint, th);
+ result = osd_mkfile(info, obj, mode, hint, th, attr);
if (result == 0) {
LASSERT(obj->oo_inode != NULL);
/*
if (dof->dof_type != DFT_NODE)
attr->la_valid &= ~LA_RDEV;
- if ((valid & LA_ATIME) && (attr->la_atime == LTIME_S(inode->i_atime)))
+ if ((valid & LA_ATIME) && (attr->la_atime == inode->i_atime.tv_sec))
attr->la_valid &= ~LA_ATIME;
- if ((valid & LA_CTIME) && (attr->la_ctime == LTIME_S(inode->i_ctime)))
+ if ((valid & LA_CTIME) && (attr->la_ctime == inode->i_ctime.tv_sec))
attr->la_valid &= ~LA_CTIME;
- if ((valid & LA_MTIME) && (attr->la_mtime == LTIME_S(inode->i_mtime)))
+ if ((valid & LA_MTIME) && (attr->la_mtime == inode->i_mtime.tv_sec))
attr->la_valid &= ~LA_MTIME;
result = osd_quota_transfer(inode, attr);
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);
+ local = ldiskfs_create_inode(oh->ot_handle, pobj->oo_inode, type,
+ NULL);
if (IS_ERR(local)) {
CERROR("%s: create local error %d\n", osd_name(osd),
(int)PTR_ERR(local));
"force_over_512tb",
NULL
};
- strcat(options, opts);
+ strncat(options, opts, PAGE_SIZE);
for (rc = 0, str = options; sout[rc]; ) {
char *op = strstr(str, sout[rc]);
;
}
} else {
- strncat(options, "user_xattr,acl", 14);
+ strncat(options, "user_xattr,acl", PAGE_SIZE);
}
/* Glom up mount options */
if (*options != '\0')
- strcat(options, ",");
- strlcat(options, "no_mbcache,nodelalloc", PAGE_SIZE);
+ strncat(options, ",", PAGE_SIZE);
+ strncat(options, "no_mbcache,nodelalloc", PAGE_SIZE);
type = get_fs_type("ldiskfs");
if (!type) {
struct lu_device *d, struct lustre_cfg *cfg)
{
struct osd_device *o = osd_dev(d);
+ ssize_t count;
int rc;
ENTRY;
break;
case LCFG_PARAM:
LASSERT(&o->od_dt_dev);
- rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars,
- cfg, &o->od_dt_dev);
- if (rc > 0 || rc == -ENOSYS) {
- rc = class_process_proc_param(PARAM_OST,
- lprocfs_osd_obd_vars,
- cfg, &o->od_dt_dev);
- if (rc > 0)
- rc = 0;
- }
+ count = class_modify_config(cfg, PARAM_OSD,
+ &o->od_dt_dev.dd_kobj);
+ if (count < 0)
+ count = class_modify_config(cfg, PARAM_OST,
+ &o->od_dt_dev.dd_kobj);
+ rc = count > 0 ? 0 : count;
break;
case LCFG_PRE_CLEANUP:
osd_scrub_stop(o);
.o_health_check = osd_health_check,
};
+static ssize_t track_declares_assert_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", ldiskfs_track_declares_assert);
+}
+
+static ssize_t track_declares_assert_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ bool track_declares_assert;
+ int rc;
+
+ rc = kstrtobool(buffer, &track_declares_assert);
+ if (rc)
+ return rc;
+
+ ldiskfs_track_declares_assert = track_declares_assert;
+
+ return count;
+}
+LUSTRE_RW_ATTR(track_declares_assert);
+
static int __init osd_init(void)
{
+ struct kobject *kobj;
int rc;
CLASSERT(BH_DXLock < sizeof(((struct buffer_head *)0)->b_state) * 8);
(void *)kallsyms_lookup_name("dev_check_rdonly");
#endif
- rc = class_register_type(&osd_obd_device_ops, NULL, true,
- lprocfs_osd_module_vars,
+ rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,
LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
- if (rc)
+ if (rc) {
lu_kmem_fini(ldiskfs_caches);
+ return rc;
+ }
+
+ kobj = kset_find_obj(lustre_kset, LUSTRE_OSD_LDISKFS_NAME);
+ if (kobj) {
+ rc = sysfs_create_file(kobj,
+ &lustre_attr_track_declares_assert.attr);
+ kobject_put(kobj);
+ if (rc) {
+ CWARN("osd-ldiskfs: track_declares_assert failed to register with sysfs\n");
+ rc = 0;
+ }
+ }
return rc;
}
static void __exit osd_exit(void)
{
+ struct kobject *kobj;
+
+ kobj = kset_find_obj(lustre_kset, LUSTRE_OSD_LDISKFS_NAME);
+ if (kobj) {
+ sysfs_remove_file(kobj,
+ &lustre_attr_track_declares_assert.attr);
+ kobject_put(kobj);
+ }
class_unregister_type(LUSTRE_OSD_LDISKFS_NAME);
lu_kmem_fini(ldiskfs_caches);
}