All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <jlbec@evilplan.org>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/2] Disable indexing for directory with corrupt index
Date: Sun, 21 Aug 2011 20:55:42 -0700	[thread overview]
Message-ID: <20110822035541.GA31134@noexit.corp.google.com> (raw)
In-Reply-To: <CAJtY7HUwW2JtS3XK=k69nLcH42Q-p8MnZ1dSEm4mw49Xau_4ZA@mail.gmail.com>

On Thu, Jul 28, 2011 at 06:43:42PM -0500, Goldwyn Rodrigues wrote:
> Hi Joel,
> 
> Thanks for the review.

	No problem.  Sorry I took so long to get back to you.

> >> +static void ocfs2_dx_disable(struct inode *dir, struct buffer_head *di_bh)
> >> +{
> >> + ? ? struct ocfs2_inode_info *oi = OCFS2_I(dir);
> >> + ? ? struct ocfs2_dinode *di;
> >> + ? ? if (!di_bh) {
> >> + ? ? ? ? ? ? mlog(ML_ERROR, "Index directory corruption but unable "
> >> + ? ? ? ? ? ? ? ? ? ? "to disable dx_dir for <%llu>. Please execute "
> >> + ? ? ? ? ? ? ? ? ? ? "fsck.ocfs2\n", OCFS2_I(dir)->ip_blkno);
> >> + ? ? ? ? ? ? return;
> >> + ? ? }
> >> + ? ? di = (struct ocfs2_dinode *)di_bh->b_data;
> >> + ? ? BUG_ON(di->i_blkno != oi->ip_blkno);
> >> + ? ? mlog(ML_ERROR, "Disabling index for directory <%llu> due to"
> >> + ? ? ? ? ? ? " corruption. Please execute fsck.ocfs2\n", oi->ip_blkno);
> >
> > ? ? ? ?Please match the indentation to the open parenthesis.
> 
> You mean quotes, right?

	No, I mean parenthesis.  Both are acceptible, though.  I'd
probably do:

  mlog(ML_ERROR,
       "Disabling ..."
       " corruption...",
       oi->ip_blkno);

It's mostly a matter of taste.  The only wrong answer is an indentation
that doesn't line up with anything ;-)

> >> @@ -4364,11 +4392,17 @@ int ocfs2_prepare_dir_for_insert(struct
> >> ocfs2_super *osb,
> >> ? ? ? if (ocfs2_dir_indexed(dir)) {
> >> ? ? ? ? ? ? ? ret = ocfs2_prepare_dx_dir_for_insert(dir, parent_fe_bh,
> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? name, namelen, lookup);
> >> - ? ? ? ? ? ? if (ret)
> >> + ? ? ? ? ? ? if (ret == -EINVAL) {
> >> + ? ? ? ? ? ? ? ? ? ? ocfs2_dx_disable(dir, parent_fe_bh);
> >> + ? ? ? ? ? ? ? ? ? ? /* Reset ret */
> >> + ? ? ? ? ? ? ? ? ? ? ret = 0;
> >> + ? ? ? ? ? ? ? ? ? ? goto no_index;
> >> + ? ? ? ? ? ? } else if (ret)
> >> ? ? ? ? ? ? ? ? ? ? ? mlog_errno(ret);
> >
> > ? ? ? ?See here, you'll disable the index on a bad signature, but you
> > error when ECC fails. ?You should disable the index on both cases. ?I
> > say you return -EIO as I described above, and then disable when ret ==
> > -EIO. ?Yes, we might disable the index upon an actual read error, but
> > that's OK. ?We can rebuild it later.
> >
> 
> I understand why I disable index of a bad signature, but I fail to
> understand why I will err of ECC errors. In any case, I will change
> this to EIO. I chose EINVAL just to make it different from read
> errors. It does make sense to encompass read errors as well.

	Since ECC error returns -EIO, you'll trigger the mlog_errno(ret)
path and reject continuing.  Conversely, if you disable, the directory
can continue to work in non-indexed mode.  The same is true of read
errors for the index; disabling the index allows the directory to
continue to work.

Joel

-- 

 Joel's Second Law:

	If a code change requires additional user setup, it is wrong.

			http://www.jlbec.org/
			jlbec at evilplan.org

      reply	other threads:[~2011-08-22  3:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 15:57 [Ocfs2-devel] [PATCH 1/2] Disable indexing for directory with corrupt index Goldwyn Rodrigues
2011-07-28  9:22 ` Joel Becker
2011-07-28 23:43   ` Goldwyn Rodrigues
2011-08-22  3:55     ` Joel Becker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110822035541.GA31134@noexit.corp.google.com \
    --to=jlbec@evilplan.org \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.