Whamcloud - gitweb
- fixed stack allocations of md_op_data in llite.
authoryury <yury>
Mon, 7 Aug 2006 17:27:48 +0000 (17:27 +0000)
committeryury <yury>
Mon, 7 Aug 2006 17:27:48 +0000 (17:27 +0000)
lustre/llite/dcache.c
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_close.c
lustre/llite/llite_lib.c
lustre/llite/namei.c

index 06207a7..ad53c20 100644 (file)
@@ -281,7 +281,7 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,
 {
         int rc;
         struct it_cb_data icbd;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         struct obd_export *exp;
@@ -310,11 +310,17 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,
 
         parent = de->d_parent->d_inode;
 
-        ll_prepare_md_op_data(&op_data, parent, de->d_inode,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+
+        ll_prepare_md_op_data(op_data, parent, de->d_inode,
                               de->d_name.name, de->d_name.len, 0);
 
-        rc = md_intent_lock(exp, &op_data, NULL, 0, it, lookup_flags,
+        rc = md_intent_lock(exp, op_data, NULL, 0, it, lookup_flags,
                             &req, ll_md_blocking_ast, 0);
+
+        OBD_FREE_PTR(op_data);
         /* If req is NULL, then md_intent_lock only tried to do a lock match;
          * if all was well, it will return 1 if it found locks, 0 otherwise. */
         if (req == NULL && rc >= 0)
index 854e575..106ffbb 100644 (file)
@@ -280,15 +280,21 @@ static struct page *ll_get_dir_page(struct inode *dir, __u32 hash, int exact,
         if (!rc) {
                 struct lookup_intent it = { .it_op = IT_READDIR };
                 struct ptlrpc_request *request;
-                struct md_op_data op_data;
+                struct md_op_data *op_data;
 
-                ll_prepare_md_op_data(&op_data, dir, NULL, NULL, 0, 0);
+                OBD_ALLOC_PTR(op_data);
+                if (op_data == NULL)
+                        return ERR_PTR(-ENOMEM);
+
+                ll_prepare_md_op_data(op_data, dir, NULL, NULL, 0, 0);
 
                 rc = md_enqueue(ll_i2sbi(dir)->ll_md_exp, LDLM_IBITS, &it,
-                                LCK_CR, &op_data, &lockh, NULL, 0,
+                                LCK_CR, op_data, &lockh, NULL, 0,
                                 ldlm_completion_ast, ll_md_blocking_ast, dir,
                                 0);
 
+                OBD_FREE_PTR(op_data);
+
                 request = (struct ptlrpc_request *)it.d.lustre.it_data;
                 if (request)
                         ptlrpc_req_finished(request);
@@ -609,11 +615,15 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
         case LL_IOC_LOV_SETSTRIPE: {
                 struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
                 struct ptlrpc_request *request = NULL;
-                struct md_op_data op_data;
+                struct md_op_data *op_data;
                 struct iattr attr = { 0 };
                 int rc = 0;
 
-                ll_prepare_md_op_data(&op_data, inode,
+                OBD_ALLOC_PTR(op_data);
+                if (op_data == NULL)
+                        RETURN(-ENOMEM);
+                
+                ll_prepare_md_op_data(op_data, inode,
                                       NULL, NULL, 0, 0);
 
                 LASSERT(sizeof(lum) == sizeof(*lump));
@@ -621,7 +631,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         sizeof(lump->lmm_objects[0]));
                 rc = copy_from_user(&lum, lump, sizeof(lum));
                 if (rc)
-                        return(-EFAULT);
+                        RETURN(-EFAULT);
 
                 /*
                  * This is coming from userspace, so should be in
@@ -635,17 +645,15 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         lustre_swab_lov_user_md(&lum);
 
                 /* swabbing is done in lov_setstripe() on server side */
-                rc = md_setattr(sbi->ll_md_exp, &op_data,
+                rc = md_setattr(sbi->ll_md_exp, op_data,
                                 &attr, &lum, sizeof(lum), NULL, 0, &request);
                 if (rc) {
-                        ptlrpc_req_finished(request);
                         if (rc != -EPERM && rc != -EACCES)
                                 CERROR("md_setattr fails: rc = %d\n", rc);
-                        return rc;
                 }
+                OBD_FREE_PTR(op_data);
                 ptlrpc_req_finished(request);
-
-                return rc;
+                RETURN(rc);
         }
         case LL_IOC_LOV_GETSTRIPE: {
                 struct ptlrpc_request *request = NULL;
index cbd2ca5..f4e1078 100644 (file)
@@ -52,29 +52,35 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
                                      struct inode *inode,
                                      struct obd_client_handle *och)
 {
-        struct md_op_data op_data = { { 0 } };
+        struct md_op_data *op_data;
         struct ptlrpc_request *req = NULL;
         int rc;
+        ENTRY;
 
-        op_data.fid1 = ll_i2info(inode)->lli_fid;
-        op_data.valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
-                        OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
-                        OBD_MD_FLATIME | OBD_MD_FLMTIME |
-                        OBD_MD_FLCTIME;
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
 
-        op_data.atime = LTIME_S(inode->i_atime);
-        op_data.mtime = LTIME_S(inode->i_mtime);
-        op_data.ctime = LTIME_S(inode->i_ctime);
-        op_data.size = inode->i_size;
-        op_data.blocks = inode->i_blocks;
-        op_data.flags = inode->i_flags;
+        op_data->fid1 = ll_i2info(inode)->lli_fid;
+        op_data->valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
+                         OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+                         OBD_MD_FLATIME | OBD_MD_FLMTIME |
+                         OBD_MD_FLCTIME;
+
+        op_data->atime = LTIME_S(inode->i_atime);
+        op_data->mtime = LTIME_S(inode->i_mtime);
+        op_data->ctime = LTIME_S(inode->i_ctime);
+        op_data->size = inode->i_size;
+        op_data->blocks = inode->i_blocks;
+        op_data->flags = inode->i_flags;
 
         if (0 /* ll_is_inode_dirty(inode) */) {
-                op_data.flags = MDS_BFLAG_UNCOMMITTED_WRITES;
-                op_data.valid |= OBD_MD_FLFLAGS;
+                op_data->flags = MDS_BFLAG_UNCOMMITTED_WRITES;
+                op_data->valid |= OBD_MD_FLFLAGS;
         }
 
-        rc = md_close(md_exp, &op_data, och, &req);
+        rc = md_close(md_exp, op_data, och, &req);
+        OBD_FREE_PTR(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. */
@@ -184,18 +190,23 @@ static int ll_intent_file_open(struct file *file, void *lmm,
         const char *name = file->f_dentry->d_name.name;
         const int len = file->f_dentry->d_name.len;
         struct lustre_handle lockh;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int rc;
 
         if (!parent)
                 RETURN(-ENOENT);
 
-        ll_prepare_md_op_data(&op_data, parent->d_inode, NULL,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+
+        ll_prepare_md_op_data(op_data, parent->d_inode, NULL,
                               name, len, O_RDWR);
 
-        rc = md_enqueue(sbi->ll_md_exp, LDLM_IBITS, itp, LCK_PW, &op_data,
+        rc = md_enqueue(sbi->ll_md_exp, LDLM_IBITS, itp, LCK_PW, op_data,
                         &lockh, lmm, lmmsize, ldlm_completion_ast,
                         ll_md_blocking_ast, NULL, 0);
+        OBD_FREE_PTR(op_data);
         if (rc < 0) {
                 CERROR("lock enqueue: err: %d\n", rc);
                 RETURN(rc);
@@ -1923,7 +1934,7 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
         struct lookup_intent oit = { .it_op = IT_GETATTR };
         struct inode *inode = dentry->d_inode;
         struct ptlrpc_request *req = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         struct ll_inode_info *lli;
         struct ll_sb_info *sbi;
         int rc;
@@ -1942,10 +1953,15 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
         lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_REVALIDATE);
 #endif
 
-        ll_prepare_md_op_data(&op_data, inode, inode, NULL, 0, 0);
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+
+        ll_prepare_md_op_data(op_data, inode, inode, NULL, 0, 0);
 
-        rc = md_intent_lock(sbi->ll_md_exp, &op_data, NULL, 0, &oit, 0,
+        rc = md_intent_lock(sbi->ll_md_exp, op_data, NULL, 0, &oit, 0,
                             &req, ll_md_blocking_ast, 0);
+        OBD_FREE_PTR(op_data);
 
         if (rc < 0)
                 GOTO(out, rc);
index 32da443..82c6bb1 100644 (file)
@@ -122,7 +122,7 @@ static void ll_close_done_writing(struct inode *inode)
         struct ll_inode_info *lli = ll_i2info(inode);
         ldlm_policy_data_t policy = { .l_extent = {0, OBD_OBJECT_EOF } };
         struct lustre_handle lockh = { 0 };
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         struct obdo obdo;
         obd_flag valid;
         int rc, ast_flags = 0;
@@ -163,12 +163,20 @@ static void ll_close_done_writing(struct inode *inode)
                 CERROR("unlock failed (%d)?  proceeding anyways...\n", rc);
 
  rpc:
-        op_data.fid1 = lli->lli_fid;
-        op_data.size = inode->i_size;
-        op_data.blocks = inode->i_blocks;
-        op_data.valid = OBD_MD_FLID | OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL) {
+                CERROR("can't allocate op_data\n");
+                EXIT;
+                return;
+        }
+        
+        op_data->fid1 = lli->lli_fid;
+        op_data->size = inode->i_size;
+        op_data->blocks = inode->i_blocks;
+        op_data->valid = OBD_MD_FLID | OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
 
-        rc = md_done_writing(ll_i2sbi(inode)->ll_md_exp, &op_data);
+        rc = md_done_writing(ll_i2sbi(inode)->ll_md_exp, op_data);
+        OBD_FREE_PTR(op_data);
  out:
 }
 #endif
index 29cbd7b..0531b70 100644 (file)
@@ -902,7 +902,7 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct ptlrpc_request *request = NULL;
         int ia_valid = attr->ia_valid;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int rc = 0;
         ENTRY;
 
@@ -956,10 +956,15 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
         if (ia_valid & (lsm ? ~(ATTR_SIZE | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
                 struct lustre_md md;
 
-                ll_prepare_md_op_data(&op_data, inode, NULL, NULL, 0, 0);
+                OBD_ALLOC_PTR(op_data);
+                if (op_data == NULL)
+                        RETURN(-ENOMEM);
+                
+                ll_prepare_md_op_data(op_data, inode, NULL, NULL, 0, 0);
 
-                rc = md_setattr(sbi->ll_md_exp, &op_data,
+                rc = md_setattr(sbi->ll_md_exp, op_data,
                                 attr, NULL, 0, NULL, 0, &request);
+                OBD_FREE_PTR(op_data);
 
                 if (rc) {
                         ptlrpc_req_finished(request);
@@ -1445,7 +1450,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
         case EXT3_IOC_SETFLAGS: {
                 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
                 struct ll_iattr_struct attr;
-                struct md_op_data op_data;
+                struct md_op_data *op_data;
                 struct obdo *oa;
 
                 if (get_user(flags, (int *)arg))
@@ -1455,14 +1460,19 @@ int ll_iocontrol(struct inode *inode, struct file *file,
                 if (!oa)
                         RETURN(-ENOMEM);
 
-                ll_prepare_md_op_data(&op_data, inode, NULL, NULL, 0, 0);
+                OBD_ALLOC_PTR(op_data);
+                if (op_data == NULL)
+                        RETURN(-ENOMEM);
+                
+                ll_prepare_md_op_data(op_data, inode, NULL, NULL, 0, 0);
 
                 memset(&attr, 0x0, sizeof(attr));
                 attr.ia_attr_flags = flags;
                 ((struct iattr *)&attr)->ia_valid |= ATTR_ATTR_FLAG;
 
-                rc = md_setattr(sbi->ll_md_exp, &op_data,
+                rc = md_setattr(sbi->ll_md_exp, op_data,
                                 (struct iattr *)&attr, NULL, 0, NULL, 0, &req);
+                OBD_FREE_PTR(op_data);
                 if (rc || lsm == NULL) {
                         ptlrpc_req_finished(req);
                         obdo_free(oa);
index 7d91ada..16f3cec 100644 (file)
@@ -372,7 +372,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         struct dentry *save = dentry, *retval;
         struct ptlrpc_request *req = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         struct it_cb_data icbd;
         int rc;
         ENTRY;
@@ -392,9 +392,13 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
         icbd.icbd_childp = &dentry;
         icbd.icbd_parent = parent;
 
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(ERR_PTR(-ENOMEM));
+
         /* prepare operatoin hint first */
-        ll_prepare_md_op_data(&op_data, parent, NULL, dentry->d_name.name,
-                               dentry->d_name.len, lookup_flags);
+        ll_prepare_md_op_data(op_data, parent, NULL, dentry->d_name.name,
+                              dentry->d_name.len, lookup_flags);
 
         /* allocate new fid for child */
         if (it->it_op & IT_CREAT ||
@@ -403,7 +407,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
                                                   .ph_cname = &dentry->d_name,
                                                   .ph_opc = LUSTRE_OPC_CREATE };
 
-                rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data.fid2, &hint);
+                rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, &hint);
                 if (rc) {
                         CERROR("can't allocate new fid, rc %d\n", rc);
                         LBUG();
@@ -412,9 +416,10 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
 
         it->it_create_mode &= ~current->fs->umask;
 
-        rc = md_intent_lock(ll_i2mdexp(parent), &op_data, NULL, 0, it,
+        rc = md_intent_lock(ll_i2mdexp(parent), op_data, NULL, 0, it,
                             lookup_flags, &req, ll_md_blocking_ast, 0);
-
+        OBD_FREE_PTR(op_data);
+        
         if (rc < 0)
                 GOTO(out, retval = ERR_PTR(rc));
 
@@ -554,7 +559,7 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
         struct ptlrpc_request *request = NULL;
         struct inode *inode = NULL;
         struct ll_sb_info *sbi = ll_i2sbi(dir);
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         struct lu_placement_hint hint = {
                 .ph_pname = NULL,
                 .ph_cname = name,
@@ -577,14 +582,18 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
         case S_IFBLK:
         case S_IFIFO:
         case S_IFSOCK:
-                ll_prepare_md_op_data(&op_data, dir, NULL, name->name,
+                OBD_ALLOC_PTR(op_data);
+                if (op_data == NULL)
+                        RETURN(-ENOMEM);
+                ll_prepare_md_op_data(op_data, dir, NULL, name->name,
                                       name->len, 0);
-                err = ll_fid_md_alloc(sbi, &op_data.fid2, &hint);
+                err = ll_fid_md_alloc(sbi, &op_data->fid2, &hint);
                 if (err)
                         break;
-                err = md_create(sbi->ll_md_exp, &op_data, NULL, 0, mode,
+                err = md_create(sbi->ll_md_exp, op_data, NULL, 0, mode,
                                 current->fsuid, current->fsgid,
                                 current->cap_effective, rdev, &request);
+                OBD_FREE_PTR(op_data);
                 if (err)
                         break;
                 ll_update_times(request, 0, dir);
@@ -631,7 +640,7 @@ static int ll_symlink_generic(struct inode *dir, struct dentry *dchild,
         struct ptlrpc_request *request = NULL;
         struct ll_sb_info *sbi = ll_i2sbi(dir);
         struct inode *inode = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int err;
         ENTRY;
 
@@ -639,20 +648,25 @@ static int ll_symlink_generic(struct inode *dir, struct dentry *dchild,
                name->len, name->name, dir->i_ino, dir->i_generation,
                dir, tgt);
 
-        ll_prepare_md_op_data(&op_data, dir, NULL,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+        
+        ll_prepare_md_op_data(op_data, dir, NULL,
                               name->name, name->len, 0);
 
         /* allocate new fid */
-        err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2, &hint);
+        err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data->fid2, &hint);
         if (err) {
                 CERROR("can't allocate new fid, rc %d\n", err);
                 LBUG();
         }
 
-        err = md_create(sbi->ll_md_exp, &op_data,
+        err = md_create(sbi->ll_md_exp, op_data,
                         tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
                         current->fsuid, current->fsgid, current->cap_effective,
                         0, &request);
+        OBD_FREE_PTR(op_data);
         if (err == 0) {
                 ll_update_times(request, 0, dir);
 
@@ -673,7 +687,7 @@ static int ll_link_generic(struct inode *src,  struct inode *dir,
 {
         struct ll_sb_info *sbi = ll_i2sbi(dir);
         struct ptlrpc_request *request = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int err;
 
         ENTRY;
@@ -682,19 +696,22 @@ static int ll_link_generic(struct inode *src,  struct inode *dir,
                src->i_ino, src->i_generation, src, dir->i_ino,
                dir->i_generation, dir, name->len, name->name);
 
-        ll_prepare_md_op_data(&op_data, src, dir, name->name,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+        ll_prepare_md_op_data(op_data, src, dir, name->name,
                               name->len, 0);
-        err = md_link(sbi->ll_md_exp, &op_data, &request);
+        err = md_link(sbi->ll_md_exp, op_data, &request);
+        OBD_FREE_PTR(op_data);
         if (err == 0)
                 ll_update_times(request, 0, dir);
 
         ptlrpc_req_finished(request);
-
         RETURN(err);
 }
 
-static int ll_mkdir_generic(struct inode *dir, struct qstr *name, int mode,
-                            struct dentry *dchild)
+static int ll_mkdir_generic(struct inode *dir, struct qstr *name,
+                            int mode, struct dentry *dchild)
 
 {
         struct lu_placement_hint hint = { .ph_pname = NULL,
@@ -703,7 +720,7 @@ static int ll_mkdir_generic(struct inode *dir, struct qstr *name, int mode,
         struct ptlrpc_request *request = NULL;
         struct ll_sb_info *sbi = ll_i2sbi(dir);
         struct inode *inode = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int err;
         ENTRY;
         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
@@ -711,19 +728,23 @@ static int ll_mkdir_generic(struct inode *dir, struct qstr *name, int mode,
 
         mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
 
-        ll_prepare_md_op_data(&op_data, dir, NULL,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+        ll_prepare_md_op_data(op_data, dir, NULL,
                               name->name, name->len, 0);
 
         /* allocate new fid */
-        err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2, &hint);
+        err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data->fid2, &hint);
         if (err) {
                 CERROR("can't allocate new fid, rc %d\n", err);
                 LBUG();
         }
 
-        err = md_create(sbi->ll_md_exp, &op_data, NULL, 0, mode,
-                        current->fsuid, current->fsgid, current->cap_effective,
-                        0, &request);
+        err = md_create(sbi->ll_md_exp, op_data, NULL, 0, mode,
+                        current->fsuid, current->fsgid,
+                        current->cap_effective, 0, &request);
+        OBD_FREE_PTR(op_data);
         ll_update_times(request, 0, dir);
         if (!err && dchild) {
                 err = ll_prep_inode(&inode, request, 0,
@@ -742,7 +763,7 @@ static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent,
                             struct qstr *name)
 {
         struct ptlrpc_request *request = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         struct dentry *dentry;
         int rc;
         ENTRY;
@@ -761,9 +782,14 @@ static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent,
                 }
         }
 
-        ll_prepare_md_op_data(&op_data, dir, NULL, name->name,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+
+        ll_prepare_md_op_data(op_data, dir, NULL, name->name,
                               name->len, S_IFDIR);
-        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, &op_data, &request);
+        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
+        OBD_FREE_PTR(op_data);
         if (rc == 0)
                 ll_update_times(request, 0, dir);
         ptlrpc_req_finished(request);
@@ -847,16 +873,17 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
 static int ll_unlink_generic(struct inode * dir, struct qstr *name)
 {
         struct ptlrpc_request *request = NULL;
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int rc;
         ENTRY;
         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
                name->len, name->name, dir->i_ino, dir->i_generation, dir);
 
-        ll_prepare_md_op_data(&op_data, dir, NULL, name->name,
-                              name->len,  
-                              0);
-        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, &op_data, &request);
+        ll_prepare_md_op_data(op_data, dir, NULL, name->name,
+                              name->len, 0);
+        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
+        OBD_FREE_PTR(op_data);
+        
         if (rc)
                 GOTO(out, rc);
 
@@ -873,7 +900,7 @@ static int ll_rename_generic(struct inode *src, struct qstr *src_name,
 {
         struct ptlrpc_request *request = NULL;
         struct ll_sb_info *sbi = ll_i2sbi(src);
-        struct md_op_data op_data;
+        struct md_op_data *op_data;
         int err;
         ENTRY;
         CDEBUG(D_VFSTRACE,"VFS Op:oldname=%.*s,src_dir=%lu/%u(%p),newname=%.*s,"
@@ -881,10 +908,15 @@ static int ll_rename_generic(struct inode *src, struct qstr *src_name,
                src->i_ino, src->i_generation, src, tgt_name->len,
                tgt_name->name, tgt->i_ino, tgt->i_generation, tgt);
 
-        ll_prepare_md_op_data(&op_data, src, tgt, NULL, 0, 0);
-        err = md_rename(sbi->ll_md_exp, &op_data,
+        OBD_ALLOC_PTR(op_data);
+        if (op_data == NULL)
+                RETURN(-ENOMEM);
+
+        ll_prepare_md_op_data(op_data, src, tgt, NULL, 0, 0);
+        err = md_rename(sbi->ll_md_exp, op_data,
                         src_name->name, src_name->len,
                         tgt_name->name, tgt_name->len, &request);
+        OBD_FREE_PTR(op_data);
         if (!err) {
                 ll_update_times(request, 0, src);
                 ll_update_times(request, 0, tgt);