All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: make direntry invalid when deleting it
Date: Tue, 12 Jul 2011 08:31:38 -0700	[thread overview]
Message-ID: <4E1C68DA.6050204@oracle.com> (raw)
In-Reply-To: <201107120843.p6C8hYl5007623@acsmt357.oracle.com>

Acked-by: Sunil Mushran <sunil.mushran@oracle.com>

On 07/12/2011 01:43 AM, Wengang Wang wrote:
> When we deleting a direntry from a directory, if it's the first in a block we
> invalid it by setting inode to 0; otherwise, we merge the deleted one to the
> prior and contiguous direntry. And we don't truncate directories.
>
> There is a problem for the later case since inode is not set to 0.
> This problem happens when the caller passes a file position as parameter to
> ocfs2_dir_foreach_blk(). If the position happens to point to a stale(not
> the first, deleted in betweens of ocfs2_dir_foreach_blk()s) direntry, we are
> not able to recognize its staleness. So that we treat it as a live one wrongly.
>
> The fix is to set inode to 0 in both cases indicating the direntry is stale.
> This won't introduce additional IOs.
>
> Signed-off-by: Wengang Wang<wen.gang.wang@oracle.com>
> ---
>   fs/ocfs2/dir.c |    3 +--
>   1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index 8582e3f..3302088 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -1184,8 +1184,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
>   			if (pde)
>   				le16_add_cpu(&pde->rec_len,
>   						le16_to_cpu(de->rec_len));
> -			else
> -				de->inode = 0;
> +			de->inode = 0;
>   			dir->i_version++;
>   			ocfs2_journal_dirty(handle, bh);
>   			goto bail;

  reply	other threads:[~2011-07-12 15:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12  8:43 [Ocfs2-devel] [PATCH] ocfs2: make direntry invalid when deleting it Wengang Wang
2011-07-12 15:31 ` Sunil Mushran [this message]
2011-07-13  2:04 ` Tao Ma
2011-07-13  2:52   ` Wengang Wang
2011-08-22  4:29 ` Joel Becker

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=4E1C68DA.6050204@oracle.com \
    --to=sunil.mushran@oracle.com \
    --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.