All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junxiao Bi <junxiao.bi@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: access orphan dinode before delete entry in ocfs2_orphan_del
Date: Wed, 30 Dec 2015 15:10:30 +0800	[thread overview]
Message-ID: <56838366.6090503@oracle.com> (raw)
In-Reply-To: <567BA725.8080607@huawei.com>

On 12/24/2015 04:04 PM, Joseph Qi wrote:
> In ocfs2_orphan_del, currently it finds and deletes entry first, and
> then access orphan dir dinode. This will have a problem once
> ocfs2_journal_access_di fails. In this case, entry will be removed from
> orphan dir, but in deed the inode hasn't been deleted successfully. In
> other words, the file is missing but not actually deleted.
> So we should access orphan dinode first like unlink and rename.
> 
> Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
> Reviewed-by: Jiufei Xue <xuejiufei@huawei.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
> ---
>  fs/ocfs2/namei.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
> index 922eae9..816c667 100644
> --- a/fs/ocfs2/namei.c
> +++ b/fs/ocfs2/namei.c
> @@ -2371,6 +2371,15 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
>  	     (unsigned long long)OCFS2_I(orphan_dir_inode)->ip_blkno,
>  	     name, strlen(name));
> 
> +	status = ocfs2_journal_access_di(handle,
> +					 INODE_CACHE(orphan_dir_inode),
> +					 orphan_dir_bh,
> +					 OCFS2_JOURNAL_ACCESS_WRITE);
> +	if (status < 0) {
> +		mlog_errno(status);
> +		goto leave;
> +	}
> +
>  	/* find it's spot in the orphan directory */
>  	status = ocfs2_find_entry(name, strlen(name), orphan_dir_inode,
>  				  &lookup);
> @@ -2386,15 +2395,6 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
>  		goto leave;
>  	}
> 
> -	status = ocfs2_journal_access_di(handle,
> -					 INODE_CACHE(orphan_dir_inode),
> -					 orphan_dir_bh,
> -					 OCFS2_JOURNAL_ACCESS_WRITE);
> -	if (status < 0) {
> -		mlog_errno(status);
> -		goto leave;
> -	}
> -
>  	/* do the i_nlink dance! :) */
>  	orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data;
>  	if (S_ISDIR(inode->i_mode))
> 

      reply	other threads:[~2015-12-30  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-24  8:04 [Ocfs2-devel] [PATCH] ocfs2: access orphan dinode before delete entry in ocfs2_orphan_del Joseph Qi
2015-12-30  7:10 ` Junxiao Bi [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=56838366.6090503@oracle.com \
    --to=junxiao.bi@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.