public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] 2.6.29 queue
@ 2009-02-10 19:44 Christoph Hellwig
  2009-02-10 19:44 ` [PATCH 1/2] xfs: fix error handling in xfs_log_mount Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Christoph Hellwig @ 2009-02-10 19:44 UTC (permalink / raw)
  To: xfs

Two more updates for 2.6.29, one to fix a possible oops when we're out
of memory in xfs_log_mount and one to reject swapext on swapfiles.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 1/2] xfs: fix error handling in xfs_log_mount
  2009-02-10 19:44 [PATCH 0/2] 2.6.29 queue Christoph Hellwig
@ 2009-02-10 19:44 ` Christoph Hellwig
  2009-02-10 19:56   ` Felix Blyakher
  2009-02-10 19:44 ` [PATCH 2/2] xfs: reject swapext ioctl on swapfiles Christoph Hellwig
  2009-02-12 19:19 ` [PATCH 0/2] 2.6.29 queue Christoph Hellwig
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2009-02-10 19:44 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-log-mount-error-handling --]
[-- Type: text/plain, Size: 1410 bytes --]

We can't just call xfs_log_unmount_dealloc on any failure because the
ail thread which is torn down by xfs_log_unmount_dealloc might not
be initialized yet.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/xfs_log.c
===================================================================
--- xfs.orig/fs/xfs/xfs_log.c	2009-02-10 19:16:18.761945594 +0100
+++ xfs/fs/xfs/xfs_log.c	2009-02-10 19:18:54.177068965 +0100
@@ -574,7 +574,7 @@ xfs_log_mount(
 	error = xfs_trans_ail_init(mp);
 	if (error) {
 		cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
-		goto error;
+		goto out_free_log;
 	}
 	mp->m_log->l_ailp = mp->m_ail;
 
@@ -594,20 +594,22 @@ xfs_log_mount(
 			mp->m_flags |= XFS_MOUNT_RDONLY;
 		if (error) {
 			cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
-			goto error;
+			goto out_destroy_ail;
 		}
 	}
 
 	/* Normal transactions can now occur */
 	mp->m_log->l_flags &= ~XLOG_ACTIVE_RECOVERY;
 
-	/* End mounting message in xfs_log_mount_finish */
 	return 0;
-error:
-	xfs_log_unmount_dealloc(mp);
+
+out_destroy_ail:
+	xfs_trans_ail_destroy(mp);
+out_free_log:
+	xlog_dealloc_log(mp->m_log);
 out:
 	return error;
-}	/* xfs_log_mount */
+}
 
 /*
  * Finish the recovery of the file system.  This is separate from

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 2/2] xfs: reject swapext ioctl on swapfiles
  2009-02-10 19:44 [PATCH 0/2] 2.6.29 queue Christoph Hellwig
  2009-02-10 19:44 ` [PATCH 1/2] xfs: fix error handling in xfs_log_mount Christoph Hellwig
@ 2009-02-10 19:44 ` Christoph Hellwig
  2009-02-10 20:00   ` Felix Blyakher
  2009-02-12 19:19 ` [PATCH 0/2] 2.6.29 queue Christoph Hellwig
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2009-02-10 19:44 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-swapext-reject-swapfiles --]
[-- Type: text/plain, Size: 904 bytes --]

Swapfiles are magic - I/O is directly initialized by the VM without
involving the filesystem.  Swapping out extents underneath the VM thus
can cause severe problems.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/xfs_dfrag.c
===================================================================
--- xfs.orig/fs/xfs/xfs_dfrag.c	2009-02-10 19:19:25.440068967 +0100
+++ xfs/fs/xfs/xfs_dfrag.c	2009-02-10 19:20:35.182944272 +0100
@@ -79,6 +79,12 @@ xfs_swapext(
 		goto out_put_target_file;
 	}
 
+	if (IS_SWAPFILE(file->f_path.dentry->d_inode) ||
+	    IS_SWAPFILE(target_file->f_path.dentry->d_inode)) {
+		error = XFS_ERROR(EINVAL);
+		goto out_put_target_file;
+	}
+
 	ip = XFS_I(file->f_path.dentry->d_inode);
 	tip = XFS_I(target_file->f_path.dentry->d_inode);
 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 1/2] xfs: fix error handling in xfs_log_mount
  2009-02-10 19:44 ` [PATCH 1/2] xfs: fix error handling in xfs_log_mount Christoph Hellwig
@ 2009-02-10 19:56   ` Felix Blyakher
  2009-02-10 19:57     ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Felix Blyakher @ 2009-02-10 19:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

Isn't it a reworked Lachlan's patch:

http://oss.sgi.com/archives/xfs/2009-02/msg00175.html

Otherwise, looks good.

Felix

On Feb 10, 2009, at 1:44 PM, Christoph Hellwig wrote:

> We can't just call xfs_log_unmount_dealloc on any failure because the
> ail thread which is torn down by xfs_log_unmount_dealloc might not
> be initialized yet.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs/fs/xfs/xfs_log.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_log.c	2009-02-10 19:16:18.761945594 +0100
> +++ xfs/fs/xfs/xfs_log.c	2009-02-10 19:18:54.177068965 +0100
> @@ -574,7 +574,7 @@ xfs_log_mount(
> 	error = xfs_trans_ail_init(mp);
> 	if (error) {
> 		cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
> -		goto error;
> +		goto out_free_log;
> 	}
> 	mp->m_log->l_ailp = mp->m_ail;
>
> @@ -594,20 +594,22 @@ xfs_log_mount(
> 			mp->m_flags |= XFS_MOUNT_RDONLY;
> 		if (error) {
> 			cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d",  
> error);
> -			goto error;
> +			goto out_destroy_ail;
> 		}
> 	}
>
> 	/* Normal transactions can now occur */
> 	mp->m_log->l_flags &= ~XLOG_ACTIVE_RECOVERY;
>
> -	/* End mounting message in xfs_log_mount_finish */
> 	return 0;
> -error:
> -	xfs_log_unmount_dealloc(mp);
> +
> +out_destroy_ail:
> +	xfs_trans_ail_destroy(mp);
> +out_free_log:
> +	xlog_dealloc_log(mp->m_log);
> out:
> 	return error;
> -}	/* xfs_log_mount */
> +}
>
> /*
>  * Finish the recovery of the file system.  This is separate from
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 1/2] xfs: fix error handling in xfs_log_mount
  2009-02-10 19:56   ` Felix Blyakher
@ 2009-02-10 19:57     ` Christoph Hellwig
  2009-02-10 20:09       ` Felix Blyakher
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2009-02-10 19:57 UTC (permalink / raw)
  To: Felix Blyakher; +Cc: Christoph Hellwig, xfs

On Tue, Feb 10, 2009 at 01:56:31PM -0600, Felix Blyakher wrote:
> Isn't it a reworked Lachlan's patch:
>
> http://oss.sgi.com/archives/xfs/2009-02/msg00175.html

The patch isn't related to that one at all, but it aims to fix the
same issue.  Should probably get a Reported-by: tag for him, if
this is indeed the thing the original patch tried to fix.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 2/2] xfs: reject swapext ioctl on swapfiles
  2009-02-10 19:44 ` [PATCH 2/2] xfs: reject swapext ioctl on swapfiles Christoph Hellwig
@ 2009-02-10 20:00   ` Felix Blyakher
  0 siblings, 0 replies; 10+ messages in thread
From: Felix Blyakher @ 2009-02-10 20:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Feb 10, 2009, at 1:44 PM, Christoph Hellwig wrote:

> Swapfiles are magic - I/O is directly initialized by the VM without
> involving the filesystem.  Swapping out extents underneath the VM thus
> can cause severe problems.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 1/2] xfs: fix error handling in xfs_log_mount
  2009-02-10 19:57     ` Christoph Hellwig
@ 2009-02-10 20:09       ` Felix Blyakher
  2009-02-10 23:24         ` Lachlan McIlroy
  0 siblings, 1 reply; 10+ messages in thread
From: Felix Blyakher @ 2009-02-10 20:09 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Feb 10, 2009, at 1:57 PM, Christoph Hellwig wrote:

> On Tue, Feb 10, 2009 at 01:56:31PM -0600, Felix Blyakher wrote:
>> Isn't it a reworked Lachlan's patch:
>>
>> http://oss.sgi.com/archives/xfs/2009-02/msg00175.html
>
> The patch isn't related to that one at all,

... from the implementation point of view, yes.

> but it aims to fix the
> same issue.

That's what I meant.

> Should probably get a Reported-by: tag for him,

Seems reasonable.

> if
> this is indeed the thing the original patch tried to fix.

That was my understanding. Let's Lachlan pitch in.

Felix

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 1/2] xfs: fix error handling in xfs_log_mount
  2009-02-10 20:09       ` Felix Blyakher
@ 2009-02-10 23:24         ` Lachlan McIlroy
  2009-02-11 22:39           ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Lachlan McIlroy @ 2009-02-10 23:24 UTC (permalink / raw)
  To: Felix Blyakher; +Cc: Christoph Hellwig, xfs

Felix Blyakher wrote:
> 
> On Feb 10, 2009, at 1:57 PM, Christoph Hellwig wrote:
> 
>> On Tue, Feb 10, 2009 at 01:56:31PM -0600, Felix Blyakher wrote:
>>> Isn't it a reworked Lachlan's patch:
>>>
>>> http://oss.sgi.com/archives/xfs/2009-02/msg00175.html
>>
>> The patch isn't related to that one at all,
> 
> ... from the implementation point of view, yes.
> 
>> but it aims to fix the
>> same issue.
> 
> That's what I meant.
> 
>> Should probably get a Reported-by: tag for him,
> 
> Seems reasonable.
> 
>> if
>> this is indeed the thing the original patch tried to fix.
> 
> That was my understanding. Let's Lachlan pitch in.
I'd prefer both fixes go in so we have maximum defence against
this problem happening again but I'm really not fussed.

> 
> Felix
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 1/2] xfs: fix error handling in xfs_log_mount
  2009-02-10 23:24         ` Lachlan McIlroy
@ 2009-02-11 22:39           ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2009-02-11 22:39 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: Christoph Hellwig, xfs

On Wed, Feb 11, 2009 at 10:24:37AM +1100, Lachlan McIlroy wrote:
> I'd prefer both fixes go in so we have maximum defence against
> this problem happening again but I'm really not fussed.

I disagree.  All these weird error checks for things that can't happen
just make the code big, bloated and unreadable.  And they make people
sloppy by not enforcing the same unwind order thus leading to more
bugs (as seen by the historic xfs mount path before we started unwinding
it)

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 0/2] 2.6.29 queue
  2009-02-10 19:44 [PATCH 0/2] 2.6.29 queue Christoph Hellwig
  2009-02-10 19:44 ` [PATCH 1/2] xfs: fix error handling in xfs_log_mount Christoph Hellwig
  2009-02-10 19:44 ` [PATCH 2/2] xfs: reject swapext ioctl on swapfiles Christoph Hellwig
@ 2009-02-12 19:19 ` Christoph Hellwig
  2 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2009-02-12 19:19 UTC (permalink / raw)
  To: xfs

On Tue, Feb 10, 2009 at 02:44:22PM -0500, Christoph Hellwig wrote:
> Two more updates for 2.6.29, one to fix a possible oops when we're out
> of memory in xfs_log_mount and one to reject swapext on swapfiles.

Thanks for the reviews!

The patches are now available to pull from:

		git://git.kernel.org/pub/scm/fs/xfs/xfs.git
	

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2009-02-12 19:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-10 19:44 [PATCH 0/2] 2.6.29 queue Christoph Hellwig
2009-02-10 19:44 ` [PATCH 1/2] xfs: fix error handling in xfs_log_mount Christoph Hellwig
2009-02-10 19:56   ` Felix Blyakher
2009-02-10 19:57     ` Christoph Hellwig
2009-02-10 20:09       ` Felix Blyakher
2009-02-10 23:24         ` Lachlan McIlroy
2009-02-11 22:39           ` Christoph Hellwig
2009-02-10 19:44 ` [PATCH 2/2] xfs: reject swapext ioctl on swapfiles Christoph Hellwig
2009-02-10 20:00   ` Felix Blyakher
2009-02-12 19:19 ` [PATCH 0/2] 2.6.29 queue Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox