Whamcloud - gitweb
merging all noncontroversial pieces of b_symlink into HEAD
authorpschwan <pschwan>
Thu, 7 Nov 2002 00:27:20 +0000 (00:27 +0000)
committerpschwan <pschwan>
Thu, 7 Nov 2002 00:27:20 +0000 (00:27 +0000)
lustre/llite/dcache.c
lustre/llite/namei.c
lustre/llite/rw.c
lustre/llite/super.c

index f66fc5d..0f89d8a 100644 (file)
@@ -46,6 +46,9 @@ void ll_intent_release(struct dentry *de, struct lookup_intent *it)
         struct lustre_handle *handle;
         ENTRY;
 
+        /* XXX the check for RENAME2 is a workaround for old kernels 
+           which call intent_release twice in rename 
+        */
         if (it == NULL || it->it_op == IT_RENAME2) {
                 EXIT;
                 return;
@@ -57,23 +60,25 @@ void ll_intent_release(struct dentry *de, struct lookup_intent *it)
                 handle = (struct lustre_handle *)it->it_lock_handle;
                 if (it->it_op == IT_SETATTR) {
                         int rc;
-                        struct inode *inode = de->d_inode;
                         ldlm_lock_decref(handle, it->it_lock_mode);
                         rc = ldlm_cli_cancel(handle);
                         if (rc < 0)
                                 CERROR("ldlm_cli_cancel: %d\n", rc);
-                        /* XXX should we only do this when the last lock goes? */
-                        LASSERT(igrab(inode) == inode);
-                        d_delete_aliases(inode);
-                        iput(inode);
                 } else
                         ldlm_lock_decref(handle, it->it_lock_mode);
         }
 
-        if (it->it_op != IT_RELEASED_MAGIC) {
+        if (it->it_op == IT_RELEASED_MAGIC) {
+                EXIT; 
+                return;
+        }
+
+        if (de->d_it && de->d_it == it) { 
+                de->d_it = NULL;
                 up(&ll_d2d(de)->lld_it_sem);
                 it->it_op = IT_RELEASED_MAGIC;
         }
+
         EXIT;
 }
 
@@ -115,11 +120,8 @@ int ll_revalidate2(struct dentry *de, int flags, struct lookup_intent *it)
         spin_unlock(&dcache_lock);
         d_rehash(de);
 
-        if (it != NULL) { 
-                LL_SAVE_INTENT(de, it);
-        } else {
+        if (!it)
                 de->d_it = NULL;
-        }
 
         RETURN(1);
 }
index 7e61788..703cae5 100644 (file)
@@ -204,17 +204,18 @@ int ll_intent_lock(struct inode *parent, struct dentry **de,
         memcpy(it->it_lock_handle, &lockh, sizeof(lockh));
 
         request = (struct ptlrpc_request *)it->it_data;
+        /* it_disposition == 1 indicates that the server performed the
+         * intent on our behalf. */
         if (it->it_disposition) {
                 struct mds_body *mds_body;
                 int mode, symlen = 0;
                 obd_flag valid;
 
-                /* it_disposition == 1 indicates that the server performed the
-                 * intent on our behalf.  This long block is all about fixing up
-                 * the local state so that it is correct as of the moment
-                 * _before_ the operation was applied; that way, the VFS will
-                 * think that everything is normal and call Lustre's regular
-                 * FS function.
+                /* This long block is all about fixing up the local
+                 * state so that it is correct as of the moment
+                 * _before_ the operation was applied; that way, the
+                 * VFS will think that everything is normal and call
+                 * Lustre's regular FS function.
                  *
                  * If we're performing a creation, that means that unless the
                  * creation failed with EEXIST, we should fake up a negative
@@ -222,19 +223,21 @@ int ll_intent_lock(struct inode *parent, struct dentry **de,
                  *
                  * For everything else, we want to lookup to succeed. */
 
-                /* One additional note: we add an extra reference to the request
-                 * because we need to keep it around until ll_create gets
-                 * called.  For anything else which results in
-                 * LL_LOOKUP_POSITIVE, we can do the iget() immediately with the
-                 * contents of the reply (in the intent_finish callback).  In
-                 * the create case, however, we need to wait until
-                 * ll_create_node to do the iget() or the VFS will abort with
-                 * -EEXISTS. */
+                /* One additional note: we add an extra reference to
+                 * the request because we need to keep it around until
+                 * ll_create gets called.  For anything else which
+                 * results in LL_LOOKUP_POSITIVE, we can do the iget()
+                 * immediately with the contents of the reply (in the
+                 * intent_finish callback).  In the create case,
+                 * however, we need to wait until ll_create_node to do
+                 * the iget() or the VFS will abort with -EEXISTS. 
+                 */
 
                 offset = 1;
                 mds_body = lustre_msg_buf(request->rq_repmsg, offset);
                 ino = mds_body->fid1.id;
                 mode = mds_body->mode;
+
                 if (it->it_op & (IT_CREAT | IT_MKDIR | IT_SYMLINK | IT_MKNOD)) {
                         mdc_store_inode_generation(request, 2, 1);
                         /* For create ops, we want the lookup to be negative,
@@ -244,7 +247,10 @@ int ll_intent_lock(struct inode *parent, struct dentry **de,
                                 atomic_inc(&request->rq_refcount);
                                 GOTO(out, flag = LL_LOOKUP_NEGATIVE);
                         }
-                        /* Fall through to update attibutes. */
+                        /*
+                         * Fall through to update attibutes: it may already
+                         * have appeared in the namespace of another client
+                         */
                 } else if (it->it_op & (IT_GETATTR | IT_SETATTR | IT_LOOKUP |
                                         IT_READLINK)) {
                         /* For check ops, we want the lookup to succeed */
@@ -333,7 +339,28 @@ int ll_intent_lock(struct inode *parent, struct dentry **de,
                 ptlrpc_req_finished(request);
         }
 
-        if (it->it_op == IT_LOOKUP || rc < 0)
+        /* this places the intent in the dentry so that the vfs_xxx
+         *  operation can lay its hands on it; but that is not 
+         *  always needed...
+         */
+        if (it->it_status == 0 && 
+            it->it_op != IT_RENAME2 && 
+            it->it_op != IT_SETATTR &&
+            it->it_op != IT_GETATTR &&
+            it->it_op != IT_READDIR &&
+            it->it_op != IT_LOOKUP) {
+                LL_SAVE_INTENT(dentry, it);
+        } else {
+                dentry->d_it = NULL;
+                CDEBUG(D_DENTRY,
+                       "D_IT dentry %p fsdata %p intent: %s status %d\n",
+                       dentry, ll_d2d(dentry), ldlm_it2str(it->it_op),
+                       it->it_status);
+        }
+
+        if (rc < 0 || 
+            it->it_op == IT_LOOKUP
+            )
                 ll_intent_release(dentry, it);
 
         return rc;
@@ -442,16 +469,6 @@ lookup2_finish(int flag, struct ptlrpc_request *request, struct dentry **de,
         if (dentry == saved)
                 d_add(dentry, inode);
 
-        if (it->it_status == 0 && it->it_op != IT_RENAME2) {
-                LL_SAVE_INTENT(dentry, it);
-        } else {
-                dentry->d_it = NULL;
-                CDEBUG(D_DENTRY,
-                       "D_IT dentry %p fsdata %p intent: %s status %d\n",
-                       dentry, ll_d2d(dentry), ldlm_it2str(it->it_op),
-                       it->it_status);
-        }
-
         RETURN(0);
 }
 
index 5b240db..dcb2ecd 100644 (file)
@@ -75,12 +75,12 @@ static int ll_brw(int cmd, struct inode *inode, struct page *page, int create)
 {
         struct ll_inode_info *lli = ll_i2info(inode);
         struct lov_stripe_md *lsm = lli->lli_smd;
-        struct brw_cb_data *cbd = ll_init_brw_cb_data();
+        struct brw_cb_data *brw_cbd = ll_init_brw_cb_data();
         struct brw_page pg;
         int err;
         ENTRY;
 
-        if (!cbd)
+        if (!brw_cbd)
                 RETURN(-ENOMEM);
 
         pg.pg = page;
@@ -93,7 +93,8 @@ static int ll_brw(int cmd, struct inode *inode, struct page *page, int create)
 
         pg.flag = create ? OBD_BRW_CREATE : 0;
 
-        err = obd_brw(cmd, ll_i2obdconn(inode),lsm, 1, &pg, ll_sync_brw_cb, cbd);
+        err = obd_brw(cmd, ll_i2obdconn(inode),lsm, 1, &pg, ll_sync_brw_cb,
+                      brw_cbd);
 
         RETURN(err);
 } /* ll_brw */
index c58dffe..4074ab6 100644 (file)
@@ -235,71 +235,63 @@ static struct super_block * ll_read_super(struct super_block *sb,
         ptlrpc_req_finished(request);
         request = NULL;
 
-
         /* Register this mount instance with LProcFS */
-
         snprintf(mnt_name, 100, "mount_%s", sbi->ll_sb_uuid);
-        sbi->ll_mnt_root=lprocfs_reg_mnt(mnt_name);
-        if(!sbi->ll_mnt_root)
+        sbi->ll_mnt_root = lprocfs_reg_mnt(mnt_name);
+        if (!sbi->ll_mnt_root)
                 goto out_dev;
 
         /* Add the static configuration info */
-        lprocfs_add_vars(sbi->ll_mnt_root,
-                         (struct lprocfs_vars*)status_var_nm_1,
-                         (void*)sb);
-
-         /* Add the dynamic configuration stuff */
+        err = lprocfs_add_vars(sbi->ll_mnt_root,
+                               (struct lprocfs_vars *)status_var_nm_1, sb);
+        if (err)
+                CDEBUG(D_OTHER, "Unable to add procfs variables\n");
 
         /* MDC */
         obd = class_uuid2obd(mdc);
 
         /* Reuse mnt_name */
-
         sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name);
 
         memset(d_vars, 0, sizeof(d_vars));
-        d_vars[0].read_fptr=rd_dev_name;
-        d_vars[0].write_fptr=0;
-        d_vars[0].name=(char*)mnt_name;
-
+        d_vars[0].read_fptr = rd_dev_name;
+        d_vars[0].write_fptr = NULL;
+        d_vars[0].name = mnt_name;
 
         snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
                  obd->obd_type->typ_name);
-        d_vars[1].read_fptr=rd_dev_uuid;
-        d_vars[1].write_fptr=0;
-        d_vars[1].name=(char*)uuid_name;
-
-        err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
-                             (void*)obd);
-        if (err) {
-                CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
-        }
+        d_vars[1].read_fptr = rd_dev_uuid;
+        d_vars[1].write_fptr = NULL;
+        d_vars[1].name = uuid_name;
 
+        err = lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars *)d_vars,
+                               obd);
+        if (err)
+                CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables\n");
 
         /* OSC or LOV*/
         obd = class_uuid2obd(osc);
-        /* Reuse mnt_name */
 
+        /* Reuse mnt_name */
         snprintf(mnt_name, strlen(mnt_name), "status/%s/common_name",
                  obd->obd_type->typ_name);
 
         memset(d_vars, 0, sizeof(d_vars));
-        d_vars[0].read_fptr=rd_dev_name;
-        d_vars[0].write_fptr=0;
-        d_vars[0].name=(char*)mnt_name;
-
+        d_vars[0].read_fptr = rd_dev_name;
+        d_vars[0].write_fptr = NULL;
+        d_vars[0].name = mnt_name;
 
         snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
                  obd->obd_type->typ_name);
-        d_vars[1].read_fptr=rd_dev_uuid;
-        d_vars[1].write_fptr=0;
-        d_vars[1].name=(char*)uuid_name;
+        d_vars[1].read_fptr = rd_dev_uuid;
+        d_vars[1].write_fptr = NULL;
+        d_vars[1].name = uuid_name;
+
+        err = lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars *)d_vars,
+                               obd);
+        if (err)
+                CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables\n");
 
-        err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
-                             (void*)obd);
-        if (err) {
-                CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
-        }
 out_dev:
         if (mdc)
                 OBD_FREE(mdc, strlen(mdc) + 1);