* [Ocfs2-devel] [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del()
@ 2013-06-20 13:18 Younger Liu
2013-06-28 20:49 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Younger Liu @ 2013-06-20 13:18 UTC (permalink / raw)
To: ocfs2-devel
While deleting a file into orphan dir in ocfs2_orphan_del(),
it calls ocfs2_delete_entry() before ocfs2_journal_access_di().
If ocfs2_delete_entry() succeeded and ocfs2_journal_access_di()
failed, there would be a inconsistency: the file is deleted
from orphan dir, but orphan dir dinode is not updated.
So, need to call ocfs2_journal_access_di() before ocfs2_orphan_del().
Signed-off-by: Younger Liu <younger.liu@huawei.com>
---
fs/ocfs2/namei.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 087c58b..e3fce49 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2102,17 +2102,17 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
goto leave;
}
- /* remove it from the orphan directory */
- status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
+ 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;
}
- status = ocfs2_journal_access_di(handle,
- INODE_CACHE(orphan_dir_inode),
- orphan_dir_bh,
- OCFS2_JOURNAL_ACCESS_WRITE);
+ /* remove it from the orphan directory */
+ status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
if (status < 0) {
mlog_errno(status);
goto leave;
--
1.7.9.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del()
2013-06-20 13:18 [Ocfs2-devel] [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del() Younger Liu
@ 2013-06-28 20:49 ` Andrew Morton
2013-06-28 22:15 ` Sunil Mushran
2013-06-29 0:32 ` Jensen
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2013-06-28 20:49 UTC (permalink / raw)
To: ocfs2-devel
Folks, 3.10 is nigh. Could we please have some review and test of this
patch?
From: Younger Liu <younger.liu@huawei.com>
Subject: ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del()
While deleting a file into orphan dir in ocfs2_orphan_del(), it calls
ocfs2_delete_entry() before ocfs2_journal_access_di(). If
ocfs2_delete_entry() succeeded and ocfs2_journal_access_di() failed, there
would be a inconsistency: the file is deleted from orphan dir, but orphan
dir dinode is not updated.
So we need to call ocfs2_journal_access_di() before ocfs2_orphan_del().
Signed-off-by: Younger Liu <younger.liu@huawei.com>
Cc: Jie Liu <jeff.liu@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/ocfs2/namei.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff -puN fs/ocfs2/namei.c~ocfs2-should-call-ocfs2_journal_access_di-before-ocfs2_delete_entry-in-ocfs2_orphan_del fs/ocfs2/namei.c
--- a/fs/ocfs2/namei.c~ocfs2-should-call-ocfs2_journal_access_di-before-ocfs2_delete_entry-in-ocfs2_orphan_del
+++ a/fs/ocfs2/namei.c
@@ -2095,17 +2095,17 @@ int ocfs2_orphan_del(struct ocfs2_super
goto leave;
}
- /* remove it from the orphan directory */
- status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
+ 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;
}
- status = ocfs2_journal_access_di(handle,
- INODE_CACHE(orphan_dir_inode),
- orphan_dir_bh,
- OCFS2_JOURNAL_ACCESS_WRITE);
+ /* remove it from the orphan directory */
+ status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
if (status < 0) {
mlog_errno(status);
goto leave;
_
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del()
2013-06-28 20:49 ` Andrew Morton
@ 2013-06-28 22:15 ` Sunil Mushran
2013-06-29 0:32 ` Jensen
1 sibling, 0 replies; 4+ messages in thread
From: Sunil Mushran @ 2013-06-28 22:15 UTC (permalink / raw)
To: ocfs2-devel
NAK. Current code looks ok.
On Fri, Jun 28, 2013 at 1:49 PM, Andrew Morton <akpm@linux-foundation.org>wrote:
>
> Folks, 3.10 is nigh. Could we please have some review and test of this
> patch?
>
>
> From: Younger Liu <younger.liu@huawei.com>
> Subject: ocfs2: should call ocfs2_journal_access_di() before
> ocfs2_delete_entry() in ocfs2_orphan_del()
>
> While deleting a file into orphan dir in ocfs2_orphan_del(), it calls
> ocfs2_delete_entry() before ocfs2_journal_access_di(). If
> ocfs2_delete_entry() succeeded and ocfs2_journal_access_di() failed, there
> would be a inconsistency: the file is deleted from orphan dir, but orphan
> dir dinode is not updated.
>
> So we need to call ocfs2_journal_access_di() before ocfs2_orphan_del().
>
> Signed-off-by: Younger Liu <younger.liu@huawei.com>
> Cc: Jie Liu <jeff.liu@oracle.com>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: Mark Fasheh <mfasheh@suse.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> fs/ocfs2/namei.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff -puN
> fs/ocfs2/namei.c~ocfs2-should-call-ocfs2_journal_access_di-before-ocfs2_delete_entry-in-ocfs2_orphan_del
> fs/ocfs2/namei.c
> ---
> a/fs/ocfs2/namei.c~ocfs2-should-call-ocfs2_journal_access_di-before-ocfs2_delete_entry-in-ocfs2_orphan_del
> +++ a/fs/ocfs2/namei.c
> @@ -2095,17 +2095,17 @@ int ocfs2_orphan_del(struct ocfs2_super
> goto leave;
> }
>
> - /* remove it from the orphan directory */
> - status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
> + 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;
> }
>
> - status = ocfs2_journal_access_di(handle,
> - INODE_CACHE(orphan_dir_inode),
> - orphan_dir_bh,
> - OCFS2_JOURNAL_ACCESS_WRITE);
> + /* remove it from the orphan directory */
> + status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
> if (status < 0) {
> mlog_errno(status);
> goto leave;
> _
>
>
>
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20130628/4c0a2f05/attachment-0001.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del()
2013-06-28 20:49 ` Andrew Morton
2013-06-28 22:15 ` Sunil Mushran
@ 2013-06-29 0:32 ` Jensen
1 sibling, 0 replies; 4+ messages in thread
From: Jensen @ 2013-06-29 0:32 UTC (permalink / raw)
To: ocfs2-devel
reviewed-by: Jensen <shencanquan@huawei.com>
On 2013/6/29 4:49, Andrew Morton wrote:
>
> Folks, 3.10 is nigh. Could we please have some review and test of this
> patch?
>
>
> From: Younger Liu <younger.liu@huawei.com>
> Subject: ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del()
>
> While deleting a file into orphan dir in ocfs2_orphan_del(), it calls
> ocfs2_delete_entry() before ocfs2_journal_access_di(). If
> ocfs2_delete_entry() succeeded and ocfs2_journal_access_di() failed, there
> would be a inconsistency: the file is deleted from orphan dir, but orphan
> dir dinode is not updated.
>
> So we need to call ocfs2_journal_access_di() before ocfs2_orphan_del().
>
> Signed-off-by: Younger Liu <younger.liu@huawei.com>
> Cc: Jie Liu <jeff.liu@oracle.com>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: Mark Fasheh <mfasheh@suse.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> fs/ocfs2/namei.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff -puN fs/ocfs2/namei.c~ocfs2-should-call-ocfs2_journal_access_di-before-ocfs2_delete_entry-in-ocfs2_orphan_del fs/ocfs2/namei.c
> --- a/fs/ocfs2/namei.c~ocfs2-should-call-ocfs2_journal_access_di-before-ocfs2_delete_entry-in-ocfs2_orphan_del
> +++ a/fs/ocfs2/namei.c
> @@ -2095,17 +2095,17 @@ int ocfs2_orphan_del(struct ocfs2_super
> goto leave;
> }
>
> - /* remove it from the orphan directory */
> - status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
> + 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;
> }
>
> - status = ocfs2_journal_access_di(handle,
> - INODE_CACHE(orphan_dir_inode),
> - orphan_dir_bh,
> - OCFS2_JOURNAL_ACCESS_WRITE);
> + /* remove it from the orphan directory */
> + status = ocfs2_delete_entry(handle, orphan_dir_inode, &lookup);
> if (status < 0) {
> mlog_errno(status);
> goto leave;
> _
>
>
>
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-29 0:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-20 13:18 [Ocfs2-devel] [PATCH] ocfs2: should call ocfs2_journal_access_di() before ocfs2_delete_entry() in ocfs2_orphan_del() Younger Liu
2013-06-28 20:49 ` Andrew Morton
2013-06-28 22:15 ` Sunil Mushran
2013-06-29 0:32 ` Jensen
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.