- md_close() chnaged to use mdc_op_data like other md_* functions instead of using obdo.
- fixed prototype declaration for llapi_lov_get_uuids() - bug #6900
- fixed error message in ll_gns_mount_object() - bug #7146
- a lot of fixes about memory allocation/freeing:
- checks is memory is actually allocated by OBD_ALLOC() before sing it and do appropriate
actions otherwise.
- fixed many leaks on error paths.
- fixed missed OBD_FREE(capa_hash) in capa_cache_cleanup()
- fixed few on stack allocatoins of mdc_op_data in new landed stuff.
- in smfs_mount_cache() fixes correct cleanup in the cases of memory allocation failures.
Do mntput() for new mounted cache_mnt on error path.
- in smfs_umount_cache() nullify smb->smsi_cache_ftype and smb->smsi_ftype after freeing
them, to prevent attempt to free again if smfs_umount_cache() is called second time.
if (wakeup)
wake_up(&set->es_waitq);
+ EXIT;
out:
if (lnb)
OBD_FREE(lnb, oa_bufs * sizeof(struct niobuf_local));
if (oa)
obdo_free(oa);
- RETURN(rc);
+ return rc;
}
static struct cmobd_extent_info* get_next_ei(struct cmobd_write_service *ws)
RETURN(rc);
}
-static int cobd_md_close(struct obd_export *exp, struct obdo *obdo,
+static int cobd_md_close(struct obd_export *exp, struct mdc_op_data *op_data,
struct obd_client_handle *och,
struct ptlrpc_request **request)
{
RETURN(-EINVAL);
}
cobd_exp = cobd_get_exp(obd);
- rc = md_close(cobd_exp, obdo, och, request);
+ rc = md_close(cobd_exp, op_data, och, request);
RETURN(rc);
}
#define FMODE_EXEC 4
#endif
+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+
#define LBUG() \
do { \
printf("!!!LBUG at %s:%d\n", __FILE__, __LINE__); \
struct mea *mea;
struct posix_acl *posix_acl;
struct mds_remote_perm *remote_perm;
- struct lustre_key *key;
+ struct lustre_key *key;
};
void lustre_swab_remote_perm(struct mds_remote_perm *p);
__u32 create_mode;
struct mea *mea1; /* mea of inode1 */
struct mea *mea2; /* mea of inode2 */
- __u64 valid;
- __u32 flags;
+ obd_valid valid;
+ obd_flags flags;
+
+ /* fields needed for md_close() */
+ __u64 io_epoch;
+ obd_size size;
+ obd_blocks blocks;
+ obd_time mtime;
+ obd_time atime;
+ obd_time ctime;
+ obd_mode mode;
};
#define MDS_MODE_DONT_LOCK (1 << 30)
struct ptlrpc_request *open_req);
int mdc_clear_open_replay_data(struct obd_export *exp,
struct obd_client_handle *och);
-int mdc_close(struct obd_export *, struct obdo *, struct obd_client_handle *,
- struct ptlrpc_request **);
+int mdc_close(struct obd_export *, struct mdc_op_data *,
+ struct obd_client_handle *, struct ptlrpc_request **);
int mdc_readpage(struct obd_export *exp, struct lustre_id *id,
__u64, struct page *, struct ptlrpc_request **);
int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
int (*m_change_cbdata_name)(struct obd_export *, struct lustre_id *,
char *, int, struct lustre_id *,
ldlm_iterator_t, void *);
- int (*m_close)(struct obd_export *, struct obdo *,
- struct obd_client_handle *,
- struct ptlrpc_request **);
+ int (*m_close)(struct obd_export *, struct mdc_op_data *,
+ struct obd_client_handle *, struct ptlrpc_request **);
int (*m_create)(struct obd_export *, struct mdc_op_data *,
const void *, int, int, __u32, __u32,
__u64, struct ptlrpc_request **);
/* Passed as data param to class_config_parse_handler() */
struct config_llog_instance {
- char * cfg_instance;
+ char *cfg_instance;
struct obd_uuid cfg_uuid;
ptl_nid_t cfg_local_nid;
};
RETURN(rc);
}
-static inline int md_close(struct obd_export *exp, struct obdo *obdo,
+static inline int md_close(struct obd_export *exp,
+ struct mdc_op_data *op_data,
struct obd_client_handle *och,
struct ptlrpc_request **request)
{
ENTRY;
EXP_CHECK_MD_OP(exp, close);
MD_COUNTER_INCREMENT(exp->exp_obd, close);
- rc = MDP(exp->exp_obd, close)(exp, obdo, och, request);
+ rc = MDP(exp->exp_obd, close)(exp, op_data, och, request);
RETURN(rc);
}
int verbose, int quiet, int showfid);
extern int llapi_target_check(int num_types, char **obd_types, char *dir);
extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
-extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
+extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp,
+ __u32 *obdgens, int *ost_count);
extern int llapi_is_lustre_mnttype(char *type);
extern int llapi_getfacl(char *dir, char *cmd);
extern int llapi_setfacl(char *dir, char *cmd);
data->mod_time = CURRENT_TIME;
}
+static void llu_inode2mdc_data(struct mdc_op_data *op_data,
+ struct inode *inode,
+ obd_valid valid)
+{
+ struct llu_inode_info *lli = llu_i2info(inode);
+ obd_valid newvalid = 0;
+
+ LASSERT(op_data != NULL);
+ LASSERT(inode != NULL);
+
+ /* put object id there all the time. */
+ if (valid & OBD_MD_FLID) {
+ ll_inode2id(&op_data->id1, inode);
+ newvalid |= OBD_MD_FLID;
+ }
+
+ if (valid & OBD_MD_FLSIZE) {
+ op_data->size = lli->lli_st_size;
+ newvalid |= OBD_MD_MEA;
+ }
+ if (valid & OBD_MD_FLBLOCKS) {
+ op_data->blocks = lli->lli_st_blocks;
+ newvalid |= OBD_MD_FLBLOCKS;
+ }
+ if (valid & OBD_MD_FLFLAGS) {
+ op_data->flags = lli->lli_st_flags;
+ newvalid |= OBD_MD_FLFLAGS;
+ }
+ if (valid & OBD_MD_FLATIME) {
+ op_data->atime = LTIME_S(lli->lli_st_atime);
+ newvalid |= OBD_MD_FLATIME;
+ }
+ if (valid & OBD_MD_FLMTIME) {
+ op_data->mtime = LTIME_S(lli->lli_st_mtime);
+ newvalid |= OBD_MD_FLMTIME;
+ }
+ if (valid & OBD_MD_FLCTIME) {
+ op_data->ctime = LTIME_S(lli->lli_st_ctime);
+ newvalid |= OBD_MD_FLCTIME;
+ }
+
+ if (valid & OBD_MD_FLTYPE) {
+ op_data->mode = (op_data->mode & S_IALLUGO) |
+ (lli->lli_st_mode & S_IFMT);
+ newvalid |= OBD_MD_FLTYPE;
+ }
+
+ if (valid & OBD_MD_FLMODE) {
+ op_data->mode = (op_data->mode & S_IFMT) |
+ (lli->lli_st_mode & S_IALLUGO);
+ newvalid |= OBD_MD_FLMODE;
+ }
+
+ op_data->valid |= newvalid;
+}
+
void obdo_refresh_inode(struct inode *dst,
struct obdo *src,
obd_valid valid)
struct ll_file_data *fd = lli->lli_file_data;
struct ptlrpc_request *req = NULL;
struct obd_client_handle *och = &fd->fd_mds_och;
- struct obdo obdo;
+ struct mdc_op_data op_data;
int rc, valid;
ENTRY;
&fd->fd_cwlockh);
}
- obdo.o_id = lli->lli_st_ino;
- obdo.o_valid = OBD_MD_FLID;
+ memset(&op_data, 0, sizeof(op_data));
+ id_ino(&op_data.id1) = lli->lli_st_ino;
+ op_data.valid = OBD_MD_FLID;
valid = OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLSIZE |OBD_MD_FLBLOCKS |
OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME;
if (test_bit(LLI_F_HAVE_OST_SIZE_LOCK, &lli->lli_flags))
valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
- obdo_from_inode(&obdo, inode, valid);
+ llu_inode2mdc_data(&op_data, inode, valid);
if (0 /* ll_is_inode_dirty(inode) */) {
- obdo.o_flags = MDS_BFLAG_UNCOMMITTED_WRITES;
- obdo.o_valid |= OBD_MD_FLFLAGS;
+ op_data.flags = MDS_BFLAG_UNCOMMITTED_WRITES;
+ op_data.valid |= OBD_MD_FLFLAGS;
}
- rc = mdc_close(mdc_exp, &obdo, och, &req);
+ rc = mdc_close(mdc_exp, &op_data, och, &req);
if (rc == EAGAIN) {
/* We are the last writer, so the MDS has instructed us to get
* the file size and any write cookies, then close again. */
if (op_data == NULL)
return ERR_PTR(-ENOMEM);
- ll_prepare_mdc_data(op_data, dir, NULL, NULL, 0, 0);
+ ll_inode2mdc_data(op_data, dir, (OBD_MD_FLID | OBD_MD_MEA));
rc = ll_intent_alloc(&it);
if (rc)
OBD_ALLOC(op_data, sizeof(*op_data));
if (op_data == NULL)
GOTO(out, err = -ENOMEM);
- ll_prepare_mdc_data(op_data, inode, NULL, name,lums.lums_namelen,0);
+ ll_prepare_mdc_data(op_data, inode, NULL, name, lums.lums_namelen, 0);
err = md_create(sbi->ll_md_exp, op_data, &nstripes, sizeof(nstripes),
mode, current->fsuid, current->fsgid, 0, &request);
OBD_FREE(op_data, sizeof(*op_data));
struct ll_acl_ioctl_data *ioc)
{
struct ptlrpc_request *req = NULL;
- struct mdc_op_data op_data;
+ struct mdc_op_data *op_data;
struct mds_body *body;
struct iattr attr;
char *cmd;
attr.ia_valid |= ATTR_EA;
attr.ia_attr_flags = 0;
- ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
+ OBD_ALLOC(op_data, sizeof(*op_data));
+ if (!op_data)
+ GOTO(out, rc = -ENOMEM);
+
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
- rc = md_setattr(ll_i2sbi(inode)->ll_md_exp, &op_data, &attr,
- (void*) XATTR_NAME_LUSTRE_ACL,
+ rc = md_setattr(ll_i2sbi(inode)->ll_md_exp, op_data, &attr,
+ (void *)XATTR_NAME_LUSTRE_ACL,
sizeof(XATTR_NAME_LUSTRE_ACL),
- (void*) cmd, ioc->cmd_len, NULL, 0, &req);
+ (void *)cmd, ioc->cmd_len, NULL, 0, &req);
+ OBD_FREE(op_data, sizeof(*op_data));
+
if (rc) {
CERROR("md_setattr fails: rc = %d\n", rc);
GOTO(out, rc);
if (op_data == NULL)
RETURN(-ENOMEM);
- ll_prepare_mdc_data(op_data, inode, NULL, NULL, 0, 0);
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
rc = md_setattr(sbi->ll_md_exp, op_data, &attr, &lum,
sizeof(lum), NULL, 0, NULL, 0, &request);
struct obd_client_handle *och, int dirty)
{
struct ptlrpc_request *req = NULL;
- struct obdo *obdo = NULL;
+ struct mdc_op_data *op_data;
struct obd_device *obd;
+ obd_valid valid;
int rc;
ENTRY;
if (obd == NULL) {
CERROR("Invalid MDC connection handle "LPX64"\n",
md_exp->exp_handle.h_cookie);
- EXIT;
- return 0;
+ RETURN(0);
}
- /*
- * here we check if this is forced umount. If so this is called on
+ /* here we check if this is forced umount. If so this is called on
* canceling "open lock" and we do not call md_close() in this case , as
- * it will not successful, as import is already deactivated.
- */
+ * it will not successful, as import is already deactivated. */
if (obd->obd_no_recov)
GOTO(out, rc = 0);
- /* closing opened file */
- obdo = obdo_alloc();
- if (obdo == NULL)
+ /* prepare @op_data for close request */
+ OBD_ALLOC(op_data, sizeof(*op_data));
+ if (!op_data)
RETURN(-ENOMEM);
- obdo->o_id = inode->i_ino;
- obdo->o_generation = inode->i_generation;
- obdo->o_valid = OBD_MD_FLID;
- obdo_from_inode(obdo, inode, (OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLATIME | OBD_MD_FLMTIME |
- OBD_MD_FLCTIME));
+ memset(op_data, 0, sizeof(*op_data));
+
+ valid = (OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME |
+ OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLEPOCH |
+ OBD_MD_FLID);
+
+ ll_inode2mdc_data(op_data, inode, valid);
+
if (0 /* ll_is_inode_dirty(inode) */) {
- obdo->o_flags = MDS_BFLAG_UNCOMMITTED_WRITES;
- obdo->o_valid |= OBD_MD_FLFLAGS;
+ op_data->flags = MDS_BFLAG_UNCOMMITTED_WRITES;
+ op_data->valid |= OBD_MD_FLFLAGS;
}
- obdo->o_fid = id_fid(&ll_i2info(inode)->lli_id);
- obdo->o_mds = id_group(&ll_i2info(inode)->lli_id);
-
- obdo->o_valid |= OBD_MD_FLEPOCH;
- obdo->o_easize = ll_i2info(inode)->lli_io_epoch;
if (dirty) {
/* we modified data through this handle */
- obdo->o_flags |= MDS_BFLAG_DIRTY_EPOCH;
- obdo->o_valid |= OBD_MD_FLFLAGS;
- if (ll_validate_size(inode, &obdo->o_size, &obdo->o_blocks))
- obdo->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
+ op_data->flags |= MDS_BFLAG_DIRTY_EPOCH;
+ op_data->valid |= OBD_MD_FLFLAGS;
+ if (ll_validate_size(inode, &op_data->size, &op_data->blocks))
+ op_data->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
}
- rc = md_close(md_exp, obdo, och, &req);
- obdo_free(obdo);
+ rc = md_close(md_exp, op_data, och, &req);
+ OBD_FREE(op_data, sizeof(*op_data));
if (rc == EAGAIN) {
- /*
- * we are the last writer, so the MDS has instructed us to get
- * the file size and any write cookies, then close again.
- */
+ /* we are the last writer, so the MDS has instructed us to get
+ * the file size and any write cookies, then close again. */
//ll_queue_done_writing(inode);
rc = 0;
int flags, struct lov_user_md *lum,
int lum_size)
{
- struct ll_inode_info *lli = ll_i2info(inode);
- struct file *f;
- struct obd_export *exp = ll_i2dtexp(inode);
- struct lov_stripe_md *lsm;
struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags};
+ struct ll_inode_info *lli = ll_i2info(inode);
struct ptlrpc_request *req = NULL;
- int rc = 0;
- struct lustre_md md;
struct obd_client_handle *och;
+ struct lov_stripe_md *lsm;
+ struct lustre_md md;
+ struct file *f;
+ int rc = 0;
ENTRY;
if (rc < 0)
GOTO(out, rc);
- rc = mdc_req2lustre_md(ll_i2mdexp(inode), req, 1, exp, &md);
+ rc = mdc_req2lustre_md(ll_i2mdexp(inode), req, 1,
+ ll_i2dtexp(inode), &md);
if (rc)
GOTO(out, rc);
ll_update_inode(f->f_dentry->d_inode, &md);
OBD_ALLOC(och, sizeof(struct obd_client_handle));
+ if (!och)
+ GOTO(out, rc = -ENOMEM);
+
+ /* actually ll_local_open() cannot fail! */
rc = ll_local_open(f, &oit, och);
- if (rc) { /* Actually ll_local_open cannot fail! */
+ if (rc)
GOTO(out, rc);
- }
+
if (LUSTRE_IT(&oit)->it_lock_mode) {
ldlm_lock_decref_and_cancel((struct lustre_handle *)
&LUSTRE_IT(&oit)->it_lock_handle,
ll_intent_release(&oit);
- /* ll_file_release will decrease the count, but won't free anything
- because we have at least one more reference coming from actual open
- */
+ /* ll_file_release() will decrease the count, but won't free anything
+ * because we have at least one more reference coming from actual
+ * open. */
down(&lli->lli_och_sem);
lli->lli_open_fd_write_count++;
up(&lli->lli_och_sem);
/* Now also destroy our supplemental och */
ll_md_och_close(ll_i2mdexp(inode), f->f_dentry->d_inode, och, 0);
EXIT;
- out:
+out:
ll_intent_release(&oit);
if (f)
put_filp(f);
unsigned long arg)
{
int flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE;
- struct lov_user_md *lump;
int lum_size = sizeof(struct lov_user_md) +
sizeof(struct lov_user_ost_data);
+ struct lov_user_md *lump;
int rc;
ENTRY;
- if (!capable (CAP_SYS_ADMIN))
+ if (!capable(CAP_SYS_ADMIN))
RETURN(-EPERM);
OBD_ALLOC(lump, lum_size);
- if (lump == NULL) {
+ if (lump == NULL)
RETURN(-ENOMEM);
- }
+
rc = copy_from_user(lump, (struct lov_user_md *)arg, lum_size);
- if (rc) {
- OBD_FREE(lump, lum_size);
- RETURN(-EFAULT);
- }
+ if (rc)
+ GOTO(out_free_lump, rc = -EFAULT);
rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size);
-
+ EXIT;
+out_free_lump:
OBD_FREE(lump, lum_size);
- RETURN(rc);
+ return rc;
}
static int ll_lov_setstripe(struct inode *inode, struct file *file,
unsigned long arg)
{
struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
- int rc;
- int flags = FMODE_WRITE;
+ int rc, flags = FMODE_WRITE;
ENTRY;
/* Bug 1152: copy properly when this is no longer true */
{
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ptlrpc_request *request = NULL;
- struct mdc_op_data op_data;
+ struct mdc_op_data *op_data;
struct iattr attr;
void *key = NULL;
int rc = 0, key_size = 0;
&key, &key_size);
}
- ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
+ OBD_ALLOC(op_data, sizeof(*op_data));
+ if (!op_data)
+ RETURN(-ENOMEM);
+
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
- rc = md_setattr(sbi->ll_md_exp, &op_data, &attr,
- (void*) name, strnlen(name, XATTR_NAME_MAX) + 1,
- (void*) value, size, key, key_size, &request);
+ rc = md_setattr(sbi->ll_md_exp, op_data, &attr,
+ (void *)name, strnlen(name, XATTR_NAME_MAX) + 1,
+ (void *)value, size, key, key_size, &request);
if (key && key_size)
OBD_FREE(key, key_size);
path = d_path(dentry, mnt, pathpage, PAGE_SIZE);
if (IS_ERR(path)) {
CERROR("can't build mount object path, err %d\n",
- (int)PTR_ERR(dchild));
- GOTO(cleanup, rc = PTR_ERR(dchild));
+ (int)PTR_ERR(path));
+ GOTO(cleanup, rc = PTR_ERR(path));
}
/* synchronizing with possible /proc/fs/...write */
*acl = posix_acl_dup(lli->lli_posix_acl);
*lkey = lustre_key_get(lli->lli_key_info);
spin_unlock(&lli->lli_lock);
+ EXIT;
out:
if (req)
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int ll_init_key_perm(struct key_perm *kperm, struct posix_acl *acl,
__u32 uid, __u32 gid, int mode)
{
+ ENTRY;
if (acl) {
kperm->kp_acl_count = acl->a_count;
memcpy(kperm->kp_acls, acl->a_entries,
}
}
- rc = posix_acl_create_masq(*acl, &mode);
+ rc = posix_acl_create_masq(*acl, &mode);
+ EXIT;
out:
if (buf)
OBD_FREE(buf, buf_size);
- RETURN(rc);
+ return rc;
}
int ll_gks_create_key(struct inode *dir, mode_t mode, void **key,
{
struct obd_export *gs_exp = ll_i2gsexp(dir);
struct key_context *kcontext = NULL;
- struct key_parms kparms;
struct posix_acl *default_acl = NULL;
- int rc = 0;
+ struct key_parms kparms;
+ int rc = 0;
ENTRY;
OBD_ALLOC(kcontext, sizeof(struct key_context));
if (!*key)
GOTO(out, rc = -ENOMEM);
- /*GET an encrypt key from GS server*/
+ /* GET an encrypt key from GS server */
rc = obd_get_info(gs_exp, sizeof(struct key_parms), (void *)&kparms,
key_size, *key);
if (rc) {
(char*)((struct crypto_key *)(*key))->ck_key,
(char*)((struct crypto_key *)(*key))->ck_mac,
gs_exp);
+ EXIT;
out:
if (kcontext)
OBD_FREE(kcontext, sizeof(struct key_context));
if (default_acl)
posix_acl_release(default_acl);
- RETURN(rc);
+ return rc;
}
GOTO(out, rc);
lustre_data->it_key = key;
- lustre_data->it_key_size = key_size;
+ lustre_data->it_key_size = key_size;
+ EXIT;
out:
if (rc) {
if (key && key_size)
OBD_FREE(key, key_size);
}
- RETURN(rc);
+ return rc;
}
int ll_gks_decrypt_key(struct inode *inode, struct lookup_intent *it)
spin_unlock(&lli->lli_lock);
OBD_ALLOC(kperm, sizeof(struct key_perm));
+ if (!kperm)
+ GOTO(out, rc = -ENOMEM);
+
ll_init_key_perm(kperm, NULL, current->uid, current->gid, 0);
kparms.context = kcontext;
spin_lock(&lli->lli_lock);
memcpy(&lkey->lk_dk, ckey->ck_key, KEY_SIZE);
SET_DECRYPTED(lkey->lk_flags);
- spin_unlock(&lli->lli_lock);
+ spin_unlock(&lli->lli_lock);
+ EXIT;
out:
if (acl)
posix_acl_release(acl);
OBD_FREE(kcontext, kcontext_size);
if (ckey)
OBD_FREE(ckey, ck_size);
- RETURN(rc);
+ return rc;
}
+
static void get_real_parameters(struct inode *inode, struct iattr *iattr,
struct posix_acl *new_acl, mode_t *mode,
__u32 *uid, __u32 *gid)
acl_count = new_acl ? new_acl->a_count : 0;
kperm_size = crypto_kperm_size(acl_count);
OBD_ALLOC(kperm, kperm_size);
+ if (!kperm)
+ GOTO(out, rc = -ENOMEM);
+
get_real_parameters(inode, iattr, new_acl, &mac_mode, &uid, &gid);
ll_init_key_perm(kperm, new_acl, uid, gid, mac_mode);
kparms.context = kcontext;
}
*key = ckey;
iattr->ia_valid |= ATTR_MAC;
+ EXIT;
out:
if (acl)
posix_acl_release(acl);
OBD_FREE(kperm, kperm_size);
if (kcontext)
OBD_FREE(kcontext, kcontext_size);
- RETURN(rc);
+ return rc;
}
static int ll_crypt_permission_check(struct lustre_key *lkey,
int flags)
{
+ ENTRY;
if (!IS_DECRYPTED(lkey->lk_flags))
RETURN(-EFAULT);
if (flags == ENCRYPT_DATA && !IS_ENABLE_ENCRYPT(lkey->lk_flags))
LASSERT(it->d.fs_data != NULL);
lustre_data = (struct lustre_intent_data *)it->d.fs_data;
- if (lustre_data->it_key) {
+ if (lustre_data->it_key)
OBD_FREE(lustre_data->it_key, sizeof(struct crypto_key));
- }
+
OBD_ALLOC(crypto_key, sizeof(struct crypto_key));
+ if (!crypto_key)
+ RETURN(-ENOMEM);
crypto_key->ck_type = MKS_TYPE;
lustre_data->it_key = crypto_key;
struct lustre_key *lkey = NULL;
struct posix_acl *acl = NULL;
int rc = 0;
-
ENTRY;
rc = ll_get_acl_key(inode, &acl, &lkey);
GOTO(out, rc);
spin_lock(&lli->lli_lock);
SET_DECRYPTED(lkey->lk_flags);
- spin_unlock(&lli->lli_lock);
+ spin_unlock(&lli->lli_lock);
+ EXIT;
out:
if (acl)
posix_acl_release(acl);
if (lkey)
lustre_key_release(lkey);
- RETURN(rc);
+ return rc;
}
struct crypto_helper_ops ll_cmd_ops = {
list_for_each_entry(tmp, list, clist) {
if (!strcmp(type, tmp->ctype)) {
CWARN("%s is already registered\n", type);
- rc = -EEXIST;
- GOTO(exit, rc);
+ RETURN(-EEXIST);
}
}
OBD_ALLOC(opi, sizeof(*opi));
+ if (!opi)
+ RETURN(-ENOMEM);
- OBD_ALLOC(opi_name, strlen(type) + 1);
+ OBD_ALLOC(opi_name, strlen(type) + 1);
+ if (!opi_name) {
+ OBD_FREE(opi, sizeof(*opi));
+ RETURN(-ENOMEM);
+ }
- LASSERT(opi && opi_name);
-
memcpy(opi_name, type, strlen(type));
opi->ctype = opi_name;
opi->cops = cops;
list_add_tail(&opi->clist, list);
-exit:
RETURN(rc);
}
ENTRY;
OBD_ALLOC(llci, sizeof(*llci));
-
if (!llci)
RETURN(-ENOMEM);
{
struct list_head *list = &llci->ll_cops_list;
struct crypto_ops_item *tmp, *item;
+ ENTRY;
list_for_each_entry_safe(item, tmp, list, clist) {
list_del_init(&item->clist);
GOTO(out, rc);
}
ll_s2crpi(sb)->ll_gt_exp = class_conn2export(>_conn);
+ EXIT;
out:
if (rc)
lustre_destroy_crypto(sb);
- RETURN(rc);
+ return rc;
}
struct crypto_helper_ops *
ll_gks_find_ops(struct ll_crypto_info *llc_info, char *type)
}
static inline void
-ll_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+ll_inode2mdc_data(struct mdc_op_data *op_data,
+ struct inode *inode,
+ obd_valid valid)
+{
+ obd_valid newvalid = 0;
+
+ LASSERT(op_data != NULL);
+ LASSERT(inode != NULL);
+
+ /* put object id there all the time. */
+ if (valid & OBD_MD_FLID) {
+ ll_inode2id(&op_data->id1, inode);
+ newvalid |= OBD_MD_FLID;
+ }
+
+ /* it could be directory with mea */
+ if (valid & OBD_MD_MEA) {
+ op_data->mea1 = ll_i2info(inode)->lli_mea;
+ if (op_data->mea1)
+ newvalid |= OBD_MD_MEA;
+ }
+
+ if (valid & OBD_MD_FLSIZE) {
+ op_data->size = inode->i_size;
+ newvalid |= OBD_MD_FLSIZE;
+ }
+ if (valid & OBD_MD_FLBLOCKS) {
+ op_data->blocks = inode->i_blocks;
+ newvalid |= OBD_MD_FLBLOCKS;
+ }
+ if (valid & OBD_MD_FLFLAGS) {
+ op_data->flags = inode->i_flags;
+ newvalid |= OBD_MD_FLFLAGS;
+ }
+ if (valid & OBD_MD_FLATIME) {
+ op_data->atime = LTIME_S(inode->i_atime);
+ newvalid |= OBD_MD_FLATIME;
+ }
+ if (valid & OBD_MD_FLMTIME) {
+ op_data->mtime = LTIME_S(inode->i_mtime);
+ newvalid |= OBD_MD_FLMTIME;
+ }
+ if (valid & OBD_MD_FLCTIME) {
+ op_data->ctime = LTIME_S(inode->i_ctime);
+ newvalid |= OBD_MD_FLCTIME;
+ }
+ if (valid & OBD_MD_FLEPOCH) {
+ op_data->io_epoch = ll_i2info(inode)->lli_io_epoch;
+ newvalid |= OBD_MD_FLEPOCH;
+ }
+
+ if (valid & OBD_MD_FLTYPE) {
+ op_data->mode = (op_data->mode & S_IALLUGO) |
+ (inode->i_mode & S_IFMT);
+ newvalid |= OBD_MD_FLTYPE;
+ }
+
+ if (valid & OBD_MD_FLMODE) {
+ op_data->mode = (op_data->mode & S_IFMT) |
+ (inode->i_mode & S_IALLUGO);
+ newvalid |= OBD_MD_FLMODE;
+ }
+
+ op_data->valid |= newvalid;
+}
+
+static inline void
+ll_prepare_mdc_data(struct mdc_op_data *op_data, struct inode *i1,
struct inode *i2, const char *name, int namelen,
int mode)
{
- LASSERT(i1);
- ll_inode2id(&data->id1, i1);
+ LASSERT(op_data != NULL);
+ LASSERT(i1 != NULL);
+
+ ll_inode2id(&op_data->id1, i1);
/* it could be directory with mea */
- data->mea1 = ll_i2info(i1)->lli_mea;
+ op_data->mea1 = ll_i2info(i1)->lli_mea;
if (i2) {
- ll_inode2id(&data->id2, i2);
- data->mea2 = ll_i2info(i2)->lli_mea;
+ ll_inode2id(&op_data->id2, i2);
+ op_data->mea2 = ll_i2info(i2)->lli_mea;
}
- data->valid = 0;
- data->name = name;
- data->namelen = namelen;
- data->create_mode = mode;
- data->mod_time = LTIME_S(CURRENT_TIME);
+ op_data->valid = 0;
+ op_data->name = name;
+ op_data->namelen = namelen;
+ op_data->create_mode = mode;
+ op_data->mod_time = LTIME_S(CURRENT_TIME);
}
struct crypto_helper_ops {
char **lov, char **lmv, char **gkc)
{
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct lustre_profile *lprof;
struct config_llog_instance cfg;
+ struct lustre_profile *lprof;
int len, err = 0;
-
ENTRY;
if (!lmd->lmd_profile)
GOTO(out, err = -ENOMEM);
memcpy(sbi->ll_lmd, lmd, sizeof(*lmd));
- /* generate a string unique to this super, let's try
- the address of the super itself.*/
+ /* generate a string unique to this super, let's try the address of the
+ * super itself. */
len = (sizeof(sb) * 2) + 1;
OBD_ALLOC(sbi->ll_instance, len);
if (sbi->ll_instance == NULL)
OBD_ALLOC(*lov, strlen(lprof->lp_lov) +
strlen(sbi->ll_instance) + 2);
+ if (*lov = NULL)
+ GOTO(out, err = -ENOMEM);
+
sprintf(*lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
OBD_ALLOC(*lmv, strlen(lprof->lp_lmv) +
strlen(sbi->ll_instance) + 2);
+ if (*lmv == NULL)
+ GOTO(out_free_lov, err = -ENOMEM);
+
sprintf(*lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
if (lprof->lp_gkc) {
OBD_ALLOC(*gkc, strlen(lprof->lp_gkc) +
- strlen(sbi->ll_instance) + 2);
+ strlen(sbi->ll_instance) + 2);
+ if (*gkc == NULL)
+ GOTO(out_free_lmv, err = -ENOMEM);
+
sprintf(*gkc, "%s-%s", lprof->lp_gkc, sbi->ll_instance);
}
+
+ RETURN(err);
+out_free_lmv:
+ OBD_FREE(*lmv, strlen(lprof->lp_lmv) +
+ strlen(sbi->ll_instance) + 2);
+out_free_lov:
+ OBD_FREE(*lov, strlen(lprof->lp_lov) +
+ strlen(sbi->ll_instance) + 2);
out:
- RETURN(err);
+ return err;
}
static int lustre_clean_profile(struct ll_sb_info *sbi, int force_umount)
cfg.cfg_uuid = sbi->ll_sb_uuid;
OBD_ALLOC(cl_prof, len);
+ if (!cl_prof) {
+ CERROR("can't allocate memory, "
+ "skipping processing cleanup profile.\n");
+ GOTO(free_lmd, err = -ENOMEM);
+ }
+
sprintf(cl_prof, "%s-clean", lmd->lmd_profile);
err = lustre_process_log(lmd, cl_prof, &cfg, 0);
if (err < 0) {
}
OBD_FREE(cl_prof, len);
}
+ EXIT;
free_lmd:
if (sbi->ll_instance)
OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1);
OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
- RETURN(err);
+ return err;
}
int lustre_fill_super(struct super_block *sb, void *data, int silent)
if (err)
GOTO(out_free, err);
-
+
+ EXIT;
out_dev:
if (lmv)
OBD_FREE(lmv, strlen(lmv) + 1);
if (gkc)
OBD_FREE(gkc, strlen(gkc) + 1);
- RETURN(err);
+ return err;
out_free:
lustre_clean_profile(sbi, 0);
lustre_free_sbi(sb);
- GOTO(out_dev, err);
+ goto out_dev;
} /* lustre_fill_super */
OBD_ALLOC(op_data, sizeof(*op_data));
if (op_data == NULL)
RETURN(-ENOMEM);
- ll_prepare_mdc_data(op_data, inode, NULL, NULL, 0, 0);
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
if (ia_valid & (ATTR_UID | ATTR_GID)) {
rc = ll_crypto_get_mac(inode, attr, NULL, 0, &key,
obdo_free(oa);
RETURN(-ENOMEM);
}
- ll_prepare_mdc_data(op_data, inode, NULL, NULL, 0, 0);
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
memset(&attr, 0x0, sizeof(attr));
attr.ia_attr_flags = flags;
memset(&it, 0, sizeof(it));
it.it_op = IT_GETATTR;
OBD_ALLOC(it.d.fs_data, sizeof(struct lustre_intent_data));
-
+ if (!it.d.fs_data)
+ GOTO(cleanup, rc = -ENOMEM);
+
rc = md_intent_lock(lmv->tgts[id_group(&id)].ltd_exp, &id,
NULL, 0, NULL, 0, &id, &it, 0, &req,
lmv_dirobj_blocking_ast);
cb = lmv_dirobj_blocking_ast;
OBD_ALLOC(it.d.fs_data, sizeof(struct lustre_intent_data));
+ if (!it.d.fs_data)
+ GOTO(cleanup, rc = -ENOMEM);
+
if (id_equal_fid(&id, &obj->id)) {
if (master_valid) {
/* lmv_intent_getattr() already checked
RETURN(rc);
}
-static int lmv_close(struct obd_export *exp, struct obdo *obdo,
+static int lmv_close(struct obd_export *exp, struct mdc_op_data *op_data,
struct obd_client_handle *och,
struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
- int rc, i = obdo->o_mds;
+ int rc, i = id_group(&op_data->id1);
ENTRY;
rc = lmv_check_connect(obd);
RETURN(rc);
LASSERT(i < lmv->desc.ld_tgt_count);
- CDEBUG(D_OTHER, "CLOSE %lu/%lu/%lu\n", (unsigned long)obdo->o_mds,
- (unsigned long)obdo->o_id, (unsigned long)obdo->o_generation);
- rc = md_close(lmv->tgts[i].ltd_exp, obdo, och, request);
+ CDEBUG(D_OTHER, "CLOSE "DLID4"\n", OLID4(&op_data->id1));
+ rc = md_close(lmv->tgts[i].ltd_exp, op_data, och, request);
RETURN(rc);
}
if (attrlen < 0)
continue;
OBD_ALLOC(buf, attrlen);
- break;
if (!buf) {
CERROR("No MEM\n");
break;
dirent->lld_off = offset;
OBD_ALLOC(dirent, sizeof(*dirent));
-
+ if (!dirent)
+ return -ENOMEM;
+
list_add_tail(&dirent->lld_list, buf->lrc_list);
buf->lrc_dirent = dirent;
struct mdc_op_data *op_data, __u32 mode,
__u64 rdev, __u32 flags, const void *lmm,
int lmmlen, void *key, int keylen);
+
+void mdc_close_pack(struct ptlrpc_request *req, int offset,
+ struct mdc_op_data *op_data,
+ struct obd_client_handle *och);
+
void mdc_readdir_pack(struct ptlrpc_request *req, int req_offset,
__u64 offset, __u32 size, struct lustre_id *mdc_id);
-void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
- __u64 valid, struct obd_client_handle *och);
struct mdc_open_data {
struct obd_client_handle *mod_och;
}
}
-void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
- __u64 valid, struct obd_client_handle *och)
+void mdc_close_pack(struct ptlrpc_request *req, int offset,
+ struct mdc_op_data *op_data,
+ struct obd_client_handle *och)
{
+ obd_valid valid = op_data->valid;
struct mds_body *body;
- body = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*body));
- mdc_pack_id(&body->id1, oa->o_id, oa->o_generation, oa->o_mode, 0, 0);
+ body = lustre_msg_buf(req->rq_reqmsg, offset,
+ sizeof(*body));
+ body->id1 = op_data->id1;
memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
- if (oa->o_valid & OBD_MD_FLATIME) {
- body->atime = oa->o_atime;
+ if (valid & OBD_MD_FLATIME) {
+ body->atime = op_data->atime;
body->valid |= OBD_MD_FLATIME;
}
- if (oa->o_valid & OBD_MD_FLMTIME) {
- body->mtime = oa->o_mtime;
+ if (valid & OBD_MD_FLMTIME) {
+ body->mtime = op_data->mtime;
body->valid |= OBD_MD_FLMTIME;
}
- if (oa->o_valid & OBD_MD_FLCTIME) {
- body->ctime = oa->o_ctime;
+ if (valid & OBD_MD_FLCTIME) {
+ body->ctime = op_data->ctime;
body->valid |= OBD_MD_FLCTIME;
}
- if (oa->o_valid & OBD_MD_FLSIZE) {
- body->size = oa->o_size;
+ if (valid & OBD_MD_FLSIZE) {
+ body->size = op_data->size;
body->valid |= OBD_MD_FLSIZE;
}
- if (oa->o_valid & OBD_MD_FLBLOCKS) {
- body->blocks = oa->o_blocks;
+ if (valid & OBD_MD_FLBLOCKS) {
+ body->blocks = op_data->blocks;
body->valid |= OBD_MD_FLBLOCKS;
}
- if (oa->o_valid & OBD_MD_FLFLAGS) {
- body->flags = oa->o_flags;
+ if (valid & OBD_MD_FLFLAGS) {
+ body->flags = op_data->flags;
body->valid |= OBD_MD_FLFLAGS;
}
- if (oa->o_valid & OBD_MD_FLEPOCH) {
- body->io_epoch = oa->o_easize;
+ if (valid & OBD_MD_FLEPOCH) {
+ body->io_epoch = op_data->io_epoch;
body->valid |= OBD_MD_FLEPOCH;
}
}
spin_unlock(&open_req->rq_lock);
}
-int mdc_close(struct obd_export *exp, struct obdo *oa,
- struct obd_client_handle *och,
- struct ptlrpc_request **request)
+int mdc_close(struct obd_export *exp, struct mdc_op_data *op_data,
+ struct obd_client_handle *och, struct ptlrpc_request **request)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_import *imp = class_exp2cliimp(exp);
GOTO(out, rc = -ENOMEM);
req->rq_request_portal = MDS_CLOSE_PORTAL;
- //reqsize[0] = lustre_secdesc_size();
- //lustre_pack_secdesc(req, reqsize[0]);
-
- /* Ensure that this close's handle is fixed up during replay. */
+ /* ensure that this close's handle is fixed up during replay. */
LASSERT(och != NULL);
mod = och->och_mod;
if (likely(mod != NULL)) {
"expecting close error\n");
}
- mdc_close_pack(req, 1, oa, oa->o_valid, och);
+ mdc_close_pack(req, 1, op_data, och);
req->rq_replen = lustre_msg_size(3, repsize);
req->rq_commit_cb = mdc_commit_close;
}
int mdc_obj_create(struct obd_export *exp, struct obdo *oa,
- void *acl, int acl_size,
- struct lov_stripe_md **ea, struct obd_trans_info *oti)
+ void *acl, int acl_size, struct lov_stripe_md **ea,
+ struct obd_trans_info *oti)
{
struct ptlrpc_request *request;
struct ost_body *body;
int len = strlen(mds->mds_profile) + sizeof("-clean") + 1;
OBD_ALLOC(cln_prof, len);
+ if (!cln_prof) {
+ CERROR("can't allocate memory, processing cleanup "
+ "profile is skipped\n");
+ goto out;
+ }
+
sprintf(cln_prof, "%s-clean", mds->mds_profile);
cfg.cfg_instance = NULL;
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
OBD_FREE(cln_prof, len);
+ out:
OBD_FREE(mds->mds_profile, strlen(mds->mds_profile) + 1);
mds->mds_profile = NULL;
}
*sizep = cpu_to_le32(sizeof(*ckey));
OBD_ALLOC(md_key, sizeof(*md_key));
+ if (!md_key)
+ RETURN(-ENOMEM);
buflen = repmsg->buflens[*offset];
buf = lustre_msg_buf(repmsg, (*offset)++, buflen);
size = fsfilt_get_md(obd, inode, md_key, sizeof(*md_key),
- EA_KEY);
+ EA_KEY);
if (size <= 0) {
if (size < 0)
CERROR("Can not get gskey from MDS ino %lu rc %d\n",
LASSERT(ckey->ck_type == MKS_TYPE || ckey->ck_type == GKS_TYPE);
OBD_ALLOC(md_key, sizeof(*md_key));
- if (ckey->ck_type == MKS_TYPE) {
+ if (ckey->ck_type == MKS_TYPE)
mds_get_gskey(inode, ckey);
- }
rc = fsfilt_get_md(obd, inode, md_key, sizeof(*md_key),
EA_KEY);
}
OBD_ALLOC(n, namlen + 1);
+
+ /* XXX: should be memory allocation checked here in some more smart
+ * manner? */
+ LASSERT(n != NULL);
+
memcpy(n, name, namlen);
n[namlen] = (char) 0;
it.it_op = IT_UNLINK;
OBD_ALLOC(it.d.fs_data, sizeof(struct lustre_intent_data));
+ if (!it.d.fs_data) {
+ OBD_FREE(*rlockh, handle_size);
+ OBD_FREE(op_data, sizeof(*op_data));
+ RETURN(-ENOMEM);
+ }
rc = md_enqueue(mds->mds_md_exp, LDLM_IBITS, &it, LCK_EX,
op_data, *rlockh, NULL, 0, ldlm_completion_ast,
mds_blocking_ast, NULL);
+
OBD_FREE(op_data, sizeof(*op_data));
OBD_FREE(it.d.fs_data, sizeof(struct lustre_intent_data));
EXIT;
list_del(&ocapa->c_list);
OBD_FREE(ocapa, sizeof(*ocapa));
}
+
+ OBD_FREE(capa_hash, PAGE_SIZE);
}
ENTRY;
OBD_ALLOC(tmp_mac, MAC_SIZE);
-
+ if (!tmp_mac)
+ RETURN(-ENOMEM);
crypto_get_gks_mac(req, kperm, tmp_mac);
if (!memcmp(tmp_mac, key->ck_mac, MAC_SIZE)) {
if (!left)
left = opt_left + strlen(opt_left);
- OBD_ALLOC(tmp_opt, sizeof(struct option));
+ OBD_ALLOC(tmp_opt, sizeof(*tmp_opt));
+ if (!tmp_opt)
+ return -ENOMEM;
+
tmp_opt->opt = NULL;
tmp_opt->value = NULL;
tmp++;
}
OBD_ALLOC(name, length + 1);
+ if (!name) {
+ OBD_GREE(tmp_opt, sizeof(*tmp_opt));
+ return -ENOMEM;
+ }
+
tmp_opt->opt = name;
while (opt_left != tmp) *name++ = *opt_left++;
char *snap_cache_ftype = NULL;
int tmp = strlen(smfs_info->smsi_cache_ftype) + strlen("_snap");
- OBD_ALLOC(snap_cache_ftype, tmp + 1);
+ OBD_ALLOC(snap_cache_ftype, tmp + 1);
+ if (!snap_cache_ftype)
+ GOTO(exit, rc = -ENOMEM);
+
sprintf(snap_cache_ftype, "%s_snap", smfs_info->smsi_cache_ftype);
snap_sinfo->snap_cache_fsfilt = fsfilt_get_ops(snap_cache_ftype);
OBD_FREE(snap_cache_ftype, tmp + 1);
int tmp = strlen(smfs_info->smsi_ftype) + strlen("_snap");
OBD_ALLOC(snap_ftype, tmp + 1);
+ if (!snap_ftype)
+ GOTO(exit, rc = -ENOMEM);
+
sprintf(snap_ftype, "%s_snap", smfs_info->smsi_ftype);
snap_sinfo->snap_fsfilt = fsfilt_get_ops(snap_ftype);
OBD_FREE(snap_ftype, tmp + 1);
mnt = do_kern_mount(typestr, 0, devstr, (void *)opts);
if (IS_ERR(mnt)) {
- CERROR("do_kern_mount failed: rc = %ld\n",
- PTR_ERR(mnt));
- GOTO(err_out, err = PTR_ERR(mnt));
+ CERROR("do_kern_mount failed: rc = %d\n",
+ (int)PTR_ERR(mnt));
+ RETURN(PTR_ERR(mnt));
}
smb->smsi_sb = mnt->mnt_sb;
smfs_init_sm_ops(smb);
OBD_ALLOC(smb->smsi_cache_ftype, strlen(typestr) + 1);
+ if (!smb->smsi_cache_ftype)
+ GOTO(err_umount_cache, err = -ENOMEM);
+
memcpy(smb->smsi_cache_ftype, typestr, strlen(typestr));
OBD_ALLOC(smb->smsi_ftype, strlen(SMFS_TYPE) + 1);
+ if (!smb->smsi_ftype)
+ GOTO(err_free_cache_fstype, err = -ENOMEM);
+
memcpy(smb->smsi_ftype, SMFS_TYPE, strlen(SMFS_TYPE));
err = smfs_init_fsfilt_ops(smb);
-err_out:
RETURN(err);
+err_free_cache_fstype:
+ OBD_FREE(smb->smsi_cache_ftype, strlen(typestr) + 1);
+err_umount_cache:
+ mntput(mnt);
+err_out:
+ return err;
}
static int smfs_umount_cache(struct smfs_super_info *smb)
{
+ ENTRY;
+
mntput(smb->smsi_mnt);
smfs_cleanup_sm_ops(smb);
smfs_cleanup_fsfilt_ops(smb);
- if (smb->smsi_cache_ftype)
+ if (smb->smsi_cache_ftype) {
OBD_FREE(smb->smsi_cache_ftype,
strlen(smb->smsi_cache_ftype) + 1);
- if (smb->smsi_ftype)
- OBD_FREE(smb->smsi_ftype, strlen(smb->smsi_ftype) + 1);
-
- return 0;
+ smb->smsi_cache_ftype = NULL;
+ }
+ if (smb->smsi_ftype) {
+ OBD_FREE(smb->smsi_ftype,
+ strlen(smb->smsi_ftype) + 1);
+ smb->smsi_ftype = NULL;
+ }
+
+ RETURN(0);
}
/* This function initializes plugins in SMFS
* @flags: are filled while options parsing
* @sb: smfs super block
*/
-
static int smfs_init_plugins(struct super_block * sb, int flags)
{
struct smfs_super_info * smb = S2SMI(sb);