Skip to contentSkip to conversation

ocfs2: need to handle error for ocfs2_journal_access_di() call

PATCH RESEND In review Daeseok Youn 2 participants 3 messages Feb 27, 2015 – Mar 20, 2015 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 3/4 ocfs2: need to handle error for ocfs2_journal_access_di() call

There is no error handle when ocfs2_journal_access_di() is failed. And also it doesn't need to call ocfs2_dx_dir_insert() when ocfs2_journal_access_db() is failed.

---
RESEND: this patch rebased by 1/4

 fs/ocfs2/dir.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +4 -4
index c1ab24f..c63f2b6 100644
@@ -1703,15 +1703,15 @@ int __ocfs2_add_entry(handle_t *handle,
 								 insert_bh,
 					      OCFS2_JOURNAL_ACCESS_WRITE);
 
-				if (ocfs2_dir_indexed(dir)) {
+				if (!retval && ocfs2_dir_indexed(dir))
 					retval = ocfs2_dx_dir_insert(dir,
 								handle,
 								lookup);
-					if (retval)
-						goto bail;
-				}
 			}
 
+			if (retval)
+				goto bail;
+
 			/* By now the buffer is marked for journaling */
 			offset += le16_to_cpu(de->rec_len);
 			if (le64_to_cpu(de->inode)) {
Signature · 1 line
1.7.1
#1 lore raw
Quoted 26 lines · Daeseok Youn

There is no error handle when ocfs2_journal_access_di() is failed. And also it doesn't need to call ocfs2_dx_dir_insert() when ocfs2_journal_access_db() is failed.

---
RESEND: this patch rebased by 1/4

 fs/ocfs2/dir.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +1 -2
index c1ab24f..c63f2b6 100644
@@ -1703,15 +1703,15 @@ int __ocfs2_add_entry(handle_t *handle,
 								 insert_bh,
 					      OCFS2_JOURNAL_ACCESS_WRITE);
 
-				if (ocfs2_dir_indexed(dir)) {
+				if (!retval && ocfs2_dir_indexed(dir))
 					retval = ocfs2_dx_dir_insert(dir,
 								handle,
 								lookup);
-					if (retval)

fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1717

Quoted 10 lines
fs/ocfs2/dir.c +3 -2
-						goto bail;
-				}
 			}
 
+			if (retval)
+				goto bail;
+
 			/* By now the buffer is marked for journaling */
 			offset += le16_to_cpu(de->rec_len);
 			if (le64_to_cpu(de->inode)) {

I agree with you that we should do the corresponding check. But I don't think we need remove the mlog as described in my previous mail.

#2 lore raw

OK.

I will send this patch again.
This patch will be based on https://lkml.org/lkml/2015/2/27/655

thanks

regards,
Daeseok Youn

2015-03-19 20:00 GMT+09:00 Joseph Qi <[email protected]>:

Quoted 41 lines · Daeseok Youn
Quoted 26 lines

There is no error handle when ocfs2_journal_access_di() is failed. And also it doesn't need to call ocfs2_dx_dir_insert() when ocfs2_journal_access_db() is failed.

---
RESEND: this patch rebased by 1/4

 fs/ocfs2/dir.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +1 -2
index c1ab24f..c63f2b6 100644
@@ -1703,15 +1703,15 @@ int __ocfs2_add_entry(handle_t *handle,
                                                               insert_bh,
                                            OCFS2_JOURNAL_ACCESS_WRITE);
 
-                             if (ocfs2_dir_indexed(dir)) {
+                             if (!retval && ocfs2_dir_indexed(dir))
                                      retval = ocfs2_dx_dir_insert(dir,
                                                              handle,
                                                              lookup);
-                                     if (retval)

fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1717

Quoted 10 lines
fs/ocfs2/dir.c +3 -2
-                                             goto bail;
-                             }
                      }
 
+                     if (retval)
+                             goto bail;
+
                      /* By now the buffer is marked for journaling */
                      offset += le16_to_cpu(de->rec_len);
                      if (le64_to_cpu(de->inode)) {

I agree with you that we should do the corresponding check. But I don't think we need remove the mlog as described in my previous mail.