xfs: Fix error handling in write_super_lockfs/unlockfs
Subsystems (3)
PATCH 4/10 xfs: Fix error handling in write_super_lockfs/unlockfs
I've changed write_super_lockfs/unlockfs so that they always return 0 (success) to keep a current behavior.
--- xfs_super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff -uprN -X linux-2.6.27-rc7-lockfs/Documentation/dontdiff linux-2.6.27-rc7-lockfs/fs/xfs/linux-2.6/xfs_super.c linux- 2.6.27-rc7-lockfs-xfs/fs/xfs/linux-2.6/xfs_super.c
fs/xfs/linux-2.6/xfs_super.c +2 -1
@@ -1351,7 +1351,7 @@ xfs_fs_remount(* need to take care of themetadata. Once that's done write a dummy * record to dirty the log in case of a crash while frozen. */ -STATIC void +STATIC intxfs_fs_lockfs (struct super_block *sb) {
@@ -1359,6 +1359,7 @@ xfs_fs_lockfs(xfs_attr_quiesce (mp);xfs_fs_log_dummy (mp); +return 0 ; }STATIC int
Quoted 23 lines · Takashi Sato
I've changed write_super_lockfs/unlockfs so that they always return 0 (success) to keep a current behavior.
Signed-off-by Takashi Sato <[email protected]>Signed-off-by Masayuki Hamaguchi <[email protected]>--- xfs_super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)diff -uprN -X linux-2.6.27-rc7-lockfs/Documentation/dontdiff
linux-2.6.27-rc7-lockfs/fs/xfs/linux-2.6/xfs_super.clinux-2.6.27-rc7-lockfs-xfs/fs/xfs/linux-2.6/xfs_super.cfs/xfs/linux-2.6/xfs_super.c +1
-1@@ -1351,7 +1351,7 @@ xfs_fs_remount(* need to take care of themetadata. Once that's done write a dummy * record to dirty the log in case of a crash while frozen. */ -STATIC void +STATIC intxfs_fs_lockfs (struct super_block *sb) {
fs/xfs/linux-2.6/xfs_super.c xfs_fs_lockfs( · line 1363
Quoted 5 lines
fs/xfs/linux-2.6/xfs_super.c +1
-0@@ -1359,6 +1359,7 @@ xfs_fs_lockfs(xfs_attr_quiesce (mp);xfs_fs_log_dummy (mp); +return 0 ; }
xfs_fs_log_dummy() currently is void because it had nowhere to return errors to. It silently throws away errors because of this. Hence the correct thing to do here is to fix xfs_fs_log_dummy() to return the errors it currently ignores. i.e. catch the errors from xfs_trans_reserve() and xfs_trans_commit() calls in xfs_fs_log_dummy().
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 11 lines · Dave Chinner
xfs_fs_log_dummy()currently is void because it had nowhere to return errors to. It silently throws away errors because of this. Hence the correct thing to do here is to fixxfs_fs_log_dummy()to return the errors it currently ignores. i.e. catch the errors fromxfs_trans_reserve()andxfs_trans_commit()calls inxfs_fs_log_dummy().Cheers,
Dave.
Here's that part in case it's helpful :) Feel free to roll it into your patch.
-Eric
Make xfs_fs_log_dummy() return errors which can then be returned by xfs_fs_lockfs(), once it is capable of doing so.
---
fs/xfs/xfs_fsops.c +7 -4
@@ -589,17 +589,19 @@ out:return 0 ; } -void +int xfs_fs_log_dummy (xfs_mount_t *mp) {xfs_trans_t *tp;xfs_inode_t *ip; +int error =0 ; tp =_xfs_trans_alloc (mp,XFS_TRANS_DUMMY1 ); -if (xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 )) { + error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); +if (error) {xfs_trans_cancel (tp,0 ); -return ; +return error; } ip = mp->m_rootip;
@@ -609,9 +611,10 @@ xfs_fs_log_dummy(xfs_trans_ihold (tp, ip);xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );xfs_trans_set_sync (tp); -xfs_trans_commit (tp,0 ); + error =xfs_trans_commit (tp,0 );xfs_iunlock (ip,XFS_ILOCK_EXCL ); +return error; }int
fs/xfs/xfs_fsops.h +1 -1
@@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mpextern int xfs_reserve_blocks (xfs_mount_t *mp,__uint64_t *inval,xfs_fsop_resblks_t *outval);extern int xfs_fs_goingdown (xfs_mount_t *mp,__uint32_t inflags); -extern void xfs_fs_log_dummy (xfs_mount_t *mp); +extern int xfs_fs_log_dummy (xfs_mount_t *mp);#endif /* __XFS_FSOPS_H__ */
Quoted 11 lines · Dave Chinner
xfs_fs_log_dummy()currently is void because it had nowhere to return errors to. It silently throws away errors because of this. Hence the correct thing to do here is to fixxfs_fs_log_dummy()to return the errors it currently ignores. i.e. catch the errors fromxfs_trans_reserve()andxfs_trans_commit()calls inxfs_fs_log_dummy().Cheers,
Dave.
Here's that part in case it's helpful :) Feel free to roll it into your patch.
-Eric
Make xfs_fs_log_dummy() return errors which can then be returned by xfs_fs_lockfs(), once it is capable of doing so.
---
fs/xfs/xfs_fsops.c +7 -4
@@ -589,17 +589,19 @@ out:return 0 ; } -void +int xfs_fs_log_dummy (xfs_mount_t *mp) {xfs_trans_t *tp;xfs_inode_t *ip; +int error =0 ; tp =_xfs_trans_alloc (mp,XFS_TRANS_DUMMY1 ); -if (xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 )) { + error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); +if (error) {xfs_trans_cancel (tp,0 ); -return ; +return error; } ip = mp->m_rootip;
@@ -609,9 +611,10 @@ xfs_fs_log_dummy(xfs_trans_ihold (tp, ip);xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );xfs_trans_set_sync (tp); -xfs_trans_commit (tp,0 ); + error =xfs_trans_commit (tp,0 );xfs_iunlock (ip,XFS_ILOCK_EXCL ); +return error; }int
fs/xfs/xfs_fsops.h +1 -1
@@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mpextern int xfs_reserve_blocks (xfs_mount_t *mp,__uint64_t *inval,xfs_fsop_resblks_t *outval);extern int xfs_fs_goingdown (xfs_mount_t *mp,__uint32_t inflags); -extern void xfs_fs_log_dummy (xfs_mount_t *mp); +extern int xfs_fs_log_dummy (xfs_mount_t *mp);#endif /* __XFS_FSOPS_H__ */