linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/10] xfs: Fix error handling in write_super_lockfs/unlockfs
@ 2008-09-22 10:56 Takashi Sato
  2008-09-22 23:41 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Sato @ 2008-09-22 10:56 UTC (permalink / raw)
  To: Andrew Morton, Christoph Hellwig, linux-fsdevel@vger.kernel.org,
	dm-devel@redhat.com
  Cc: linux-kernel@vger.kernel.org

I've changed write_super_lockfs/unlockfs so that they always return
0 (success) to keep a current behavior.

Signed-off-by: Takashi Sato <t-sato@yk.jp.nec.com>
Signed-off-by: Masayuki Hamaguchi <m-hamaguchi@ys.jp.nec.com>
---
 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
--- linux-2.6.27-rc7-lockfs/fs/xfs/linux-2.6/xfs_super.c	2008-09-22 07:29:55.000000000 +0900
+++ linux-2.6.27-rc7-lockfs-xfs/fs/xfs/linux-2.6/xfs_super.c	2008-09-22 10:13:39.000000000 +0900
@@ -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 int
 xfs_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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/10] xfs: Fix error handling in write_super_lockfs/unlockfs
  2008-09-22 10:56 [PATCH 4/10] xfs: Fix error handling in write_super_lockfs/unlockfs Takashi Sato
@ 2008-09-22 23:41 ` Dave Chinner
  2008-09-25 21:22   ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Chinner @ 2008-09-22 23:41 UTC (permalink / raw)
  To: Takashi Sato
  Cc: Andrew Morton, Christoph Hellwig, linux-fsdevel@vger.kernel.org,
	dm-devel@redhat.com, viro@ZenIV.linux.org.uk,
	linux-ext4@vger.kernel.org, xfs@oss.sgi.com, axboe@kernel.dk,
	mtk.manpages@googlemail.com, linux-kernel@vger.kernel.org

On Mon, Sep 22, 2008 at 07:56:37PM +0900, Takashi Sato wrote:
> I've changed write_super_lockfs/unlockfs so that they always return
> 0 (success) to keep a current behavior.
> 
> Signed-off-by: Takashi Sato <t-sato@yk.jp.nec.com>
> Signed-off-by: Masayuki Hamaguchi <m-hamaguchi@ys.jp.nec.com>
> ---
>  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
> --- linux-2.6.27-rc7-lockfs/fs/xfs/linux-2.6/xfs_super.c	2008-09-22 07:29:55.000000000 +0900
> +++ linux-2.6.27-rc7-lockfs-xfs/fs/xfs/linux-2.6/xfs_super.c	2008-09-22 10:13:39.000000000 +0900
> @@ -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 int
>  xfs_fs_lockfs(
>  	struct super_block	*sb)
>  {
> @@ -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.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/10] xfs: Fix error handling in write_super_lockfs/unlockfs
  2008-09-22 23:41 ` Dave Chinner
@ 2008-09-25 21:22   ` Eric Sandeen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2008-09-25 21:22 UTC (permalink / raw)
  To: Takashi Sato, Andrew Morton, Christoph Hellwig,
	linux-fsdevel@vger.kernel.org

Dave Chinner wrote:

> 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.
>   
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.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

---

Index: linux-2.6/fs/xfs/xfs_fsops.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_fsops.c	2008-08-04 15:30:31.000000000 -0500
+++ linux-2.6/fs/xfs/xfs_fsops.c	2008-09-25 16:16:46.916001110 -0500
@@ -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
Index: linux-2.6/fs/xfs/xfs_fsops.h
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_fsops.h	2008-06-05 13:44:24.000000000 -0500
+++ linux-2.6/fs/xfs/xfs_fsops.h	2008-09-25 16:16:58.303000603 -0500
@@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mp
 extern 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__ */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 4/10] xfs: Fix error handling in write_super_lockfs/unlockfs
@ 2008-09-26  8:58 Takashi Sato
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Sato @ 2008-09-26  8:58 UTC (permalink / raw)
  To: Andrew Morton, Christoph Hellwig, linux-fsdevel@vger.kernel.org,
	dm-devel@redhat.com
  Cc: linux-kernel@vger.kernel.org

Changed write_super_lockfs so that it returns an error in case of an failure.
unlockfs always returns 0.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Takashi Sato <t-sato@yk.jp.nec.com>
Signed-off-by: Masayuki Hamaguchi <m-hamaguchi@ys.jp.nec.com>
---
 linux-2.6/xfs_super.c |    8 ++++----
 xfs_fsops.c           |   11 +++++++----
 xfs_fsops.h           |    2 +-
 3 files changed, 12 insertions(+), 9 deletions(-)

diff -uprN -X linux-2.6.27-rc7-lockfs-ext4/Documentation/dontdiff linux-2.6.27-rc7-lockfs-ext4/fs/xfs/linux-2.6/xfs_supe
r.c linux-2.6.27-rc7-lockfs-xfs/fs/xfs/linux-2.6/xfs_super.c
--- linux-2.6.27-rc7-lockfs-ext4/fs/xfs/linux-2.6/xfs_super.c	2008-09-22 07:29:55.000000000 +0900
+++ linux-2.6.27-rc7-lockfs-xfs/fs/xfs/linux-2.6/xfs_super.c	2008-09-26 20:43:42.000000000 +0900
@@ -1351,14 +1351,14 @@ 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
-xfs_fs_lockfs(
+STATIC int
+xfs_fs_freeze(
 	struct super_block	*sb)
 {
 	struct xfs_mount	*mp = XFS_M(sb);
 
 	xfs_attr_quiesce(mp);
-	xfs_fs_log_dummy(mp);
+	return -xfs_fs_log_dummy(mp);
 }
 
 STATIC int
@@ -1847,7 +1847,7 @@ static struct super_operations xfs_super
 	.put_super		= xfs_fs_put_super,
 	.write_super		= xfs_fs_write_super,
 	.sync_fs		= xfs_fs_sync_super,
-	.write_super_lockfs	= xfs_fs_lockfs,
+	.freeze_fs		= xfs_fs_freeze,
 	.statfs			= xfs_fs_statfs,
 	.remount_fs		= xfs_fs_remount,
 	.show_options		= xfs_fs_show_options,
diff -uprN -X linux-2.6.27-rc7-lockfs-ext4/Documentation/dontdiff linux-2.6.27-rc7-lockfs-ext4/fs/xfs/xfs_fsops.c linux-
2.6.27-rc7-lockfs-xfs/fs/xfs/xfs_fsops.c
--- linux-2.6.27-rc7-lockfs-ext4/fs/xfs/xfs_fsops.c	2008-09-22 07:29:55.000000000 +0900
+++ linux-2.6.27-rc7-lockfs-xfs/fs/xfs/xfs_fsops.c	2008-09-26 20:39:14.000000000 +0900
@@ -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;
 
 	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
diff -uprN -X linux-2.6.27-rc7-lockfs-ext4/Documentation/dontdiff linux-2.6.27-rc7-lockfs-ext4/fs/xfs/xfs_fsops.h linux-
2.6.27-rc7-lockfs-xfs/fs/xfs/xfs_fsops.h
--- linux-2.6.27-rc7-lockfs-ext4/fs/xfs/xfs_fsops.h	2008-09-22 07:29:55.000000000 +0900
+++ linux-2.6.27-rc7-lockfs-xfs/fs/xfs/xfs_fsops.h	2008-09-26 20:39:14.000000000 +0900
@@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mp
 extern 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__ */

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-26  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 10:56 [PATCH 4/10] xfs: Fix error handling in write_super_lockfs/unlockfs Takashi Sato
2008-09-22 23:41 ` Dave Chinner
2008-09-25 21:22   ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2008-09-26  8:58 Takashi Sato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).