return rc;
}
-static inline int fsfilt_iocontrol(struct obd_device *obd, struct inode *inode,
- struct file *file, unsigned int cmd,
- unsigned long arg)
+static inline int fsfilt_iocontrol(struct obd_device *obd, struct dentry *dentry,
+ unsigned int cmd, unsigned long arg)
{
- return obd->obd_fsops->fs_iocontrol(inode, file, cmd, arg);
+ struct file *dummy_file = NULL;
+ int ret;
+
+ OBD_ALLOC_PTR(dummy_file);
+ if (!dummy_file)
+ return(-ENOMEM);
+
+ dummy_file->f_dentry = dentry;
+ dummy_file->f_vfsmnt = obd->u.obt.obt_vfsmnt;
+
+ ret = obd->obd_fsops->fs_iocontrol(dentry->d_inode, dummy_file, cmd,
+ arg);
+
+ OBD_FREE_PTR(dummy_file);
+ return ret;
}
static inline int fsfilt_set_md(struct obd_device *obd, struct inode *inode,
lustre_quota_version_t obt_qfmt;
__u32 obt_stale_export_age;
spinlock_t obt_trans_table_lock;
+ struct vfsmount *obt_vfsmnt;
+ struct file *obt_health_check_filp;
};
typedef void (*obd_pin_extent_cb)(void *data);
/* NB this field MUST be first */
struct obd_device_target fo_obt;
const char *fo_fstype;
- struct vfsmount *fo_vfsmnt;
cfs_dentry_t *fo_dentry_O;
cfs_dentry_t **fo_dentry_O_groups;
cfs_dentry_t **fo_dentry_O_sub;
spinlock_t fo_objidlock; /* protect fo_lastobjid */
- struct file *fo_health_check_filp;
int fo_destroy_in_progress;
struct semaphore fo_create_lock;
#define fo_fsd fo_obt.obt_lsd
#define fo_last_rcvd_slots fo_obt.obt_client_bitmap
#define fo_mount_count fo_obt.obt_mount_count
+#define fo_vfsmnt fo_obt.obt_vfsmnt
#define OSC_MAX_RIF_DEFAULT 8
#define OSC_MAX_RIF_MAX 256
struct ptlrpc_service *mds_service;
struct ptlrpc_service *mds_setattr_service;
struct ptlrpc_service *mds_readpage_service;
- struct vfsmount *mds_vfsmnt;
cfs_dentry_t *mds_fid_de;
int mds_max_mdsize;
int mds_max_cookiesize;
__u32 mds_lov_objid_lastpage;
__u32 mds_lov_objid_lastidx;
- struct file *mds_health_check_filp;
struct upcall_cache *mds_group_hash;
struct lustre_quota_info mds_quota_info;
#define mds_client_bitmap mds_obt.obt_client_bitmap
#define mds_mount_count mds_obt.obt_mount_count
#define mds_last_transno mds_obt.obt_last_transno
+#define mds_vfsmnt mds_obt.obt_vfsmnt
/* lov objid */
#define mds_max_ost_index (0xFFFF)
RETURN(rc);
}
-static int fsfilt_ext3_iocontrol(struct inode * inode, struct file *file,
+static int fsfilt_ext3_iocontrol(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
int rc = 0;
-#ifdef HAVE_EXT4_LDISKFS
- struct file dummy_file;
-#endif
ENTRY;
/* FIXME: Can't do this because of nested transaction deadlock */
}
#ifdef HAVE_EXT4_LDISKFS
- /* ext4_ioctl does not have a inode argument, so create a dummy file */
- if (file == NULL) {
- OBD_ALLOC_PTR(dummy_file.f_dentry);
- if (dummy_file.f_dentry == NULL)
- RETURN(-ENOMEM);
- dummy_file.f_dentry->d_inode = inode;
- }
+ /* ext4_ioctl does not have a inode argument */
if (inode->i_fop->unlocked_ioctl)
- rc = inode->i_fop->unlocked_ioctl(file ?: &dummy_file, cmd,arg);
-
- if (file == NULL)
- OBD_FREE_PTR(dummy_file.f_dentry);
+ rc = inode->i_fop->unlocked_ioctl(file, cmd, arg);
#else
if (inode->i_fop->ioctl)
rc = inode->i_fop->ioctl(inode, file, cmd, arg);
/* We only return the full set of flags on ioctl, otherwise we
* get enough flags from the inode in mds_pack_inode2body(). */
- rc = fsfilt_iocontrol(obd, inode, NULL, FSFILT_IOC_GETFLAGS,
+ rc = fsfilt_iocontrol(obd, dentry, FSFILT_IOC_GETFLAGS,
(long)&flags);
if (rc == 0)
body->flags = flags | MDS_BFLAG_EXT_FLAGS;
rc = 1;
#ifdef USE_HEALTH_CHECK_WRITE
- LASSERT(mds->mds_health_check_filp != NULL);
- rc |= !!lvfs_check_io_health(obd, mds->mds_health_check_filp);
+ LASSERT(mds->mds_obt.obt_health_check_filp != NULL);
+ rc |= !!lvfs_check_io_health(obd, mds->mds_obt.obt_health_check_filp);
#endif
return rc;
CERROR("cannot open/create %s file: rc = %d\n",HEALTH_CHECK,rc);
GOTO(err_lov_objid, rc = PTR_ERR(file));
}
- mds->mds_health_check_filp = file;
+ mds->mds_obt.obt_health_check_filp = file;
if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
CERROR("%s is not a regular file!: mode = %o\n", HEALTH_CHECK,
file->f_dentry->d_inode->i_mode);
return rc;
err_health_check:
- if (mds->mds_health_check_filp &&
- filp_close(mds->mds_health_check_filp, 0))
+ if (mds->mds_obt.obt_health_check_filp &&
+ filp_close(mds->mds_obt.obt_health_check_filp, 0))
CERROR("can't close %s after error\n", HEALTH_CHECK);
err_lov_objid:
mds_lov_destroy_objids(obd);
mds_lov_destroy_objids(obd);
- if (mds->mds_health_check_filp) {
- rc = filp_close(mds->mds_health_check_filp, 0);
- mds->mds_health_check_filp = NULL;
+ if (mds->mds_obt.obt_health_check_filp) {
+ rc = filp_close(mds->mds_obt.obt_health_check_filp, 0);
+ mds->mds_obt.obt_health_check_filp = NULL;
if (rc)
CERROR("%s file won't close, rc=%d\n", HEALTH_CHECK,rc);
}
GOTO(cleanup, rc);
if (rec->ur_iattr.ia_valid & ATTR_ATTR_FLAG) { /* ioctl */
- rc = fsfilt_iocontrol(obd, inode, NULL, FSFILT_IOC_SETFLAGS,
+ rc = fsfilt_iocontrol(obd, de, FSFILT_IOC_SETFLAGS,
(long)&rec->ur_flags);
} else if (rec->ur_iattr.ia_valid) { /* setattr */
rc = fsfilt_setattr(obd, de, handle, &rec->ur_iattr, 0);
HEALTH_CHECK, rc);
GOTO(err_filp, rc);
}
- filter->fo_health_check_filp = file;
+ filter->fo_obt.obt_health_check_filp = file;
if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
CERROR("%s is not a regular file!: mode = %o\n", HEALTH_CHECK,
file->f_dentry->d_inode->i_mode);
//class_disconnect_exports(obd, 0);
filter_free_server_data(filter);
err_health_check:
- if (filp_close(filter->fo_health_check_filp, 0))
+ if (filp_close(filter->fo_obt.obt_health_check_filp, 0))
CERROR("can't close %s after error\n", HEALTH_CHECK);
- filter->fo_health_check_filp = NULL;
+ filter->fo_obt.obt_health_check_filp = NULL;
err_filp:
if (filp_close(filter->fo_rcvd_filp, 0))
CERROR("can't close %s after error\n", LAST_RCVD);
if (rc)
CERROR("error closing %s: rc = %d\n", LAST_RCVD, rc);
- rc = filp_close(filter->fo_health_check_filp, 0);
- filter->fo_health_check_filp = NULL;
+ rc = filp_close(filter->fo_obt.obt_health_check_filp, 0);
+ filter->fo_obt.obt_health_check_filp = NULL;
if (rc)
CERROR("error closing %s: rc = %d\n", HEALTH_CHECK, rc);
}
if (oa->o_valid & OBD_MD_FLFLAGS) {
- rc = fsfilt_iocontrol(exp->exp_obd, inode, NULL,
+ rc = fsfilt_iocontrol(exp->exp_obd, dentry,
FSFILT_IOC_SETFLAGS, (long)&oa->o_flags);
} else {
rc = fsfilt_setattr(exp->exp_obd, dentry, handle, &iattr, 1);
memcpy(fiemap, &fm_key->fiemap, sizeof(*fiemap));
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- rc = fsfilt_iocontrol(obd, dentry->d_inode, NULL,
- FSFILT_IOC_FIEMAP, (long)fiemap);
+ rc = fsfilt_iocontrol(obd, dentry, FSFILT_IOC_FIEMAP,
+ (long)fiemap);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
f_dput(dentry);
rc = 1;
#ifdef USE_HEALTH_CHECK_WRITE
- LASSERT(filter->fo_health_check_filp != NULL);
- rc |= !!lvfs_check_io_health(obd, filter->fo_health_check_filp);
+ LASSERT(filter->fo_obt.obt_health_check_filp != NULL);
+ rc |= !!lvfs_check_io_health(obd, filter->fo_obt.obt_health_check_filp);
#endif
return rc;