linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: set s_type in alloc_super()
@ 2013-01-30  0:16 Jeff Layton
  2013-01-30 15:08 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2013-01-30  0:16 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, sandeen

I see no reason to wait until after the "set" operation returns to set
the s_type. We do call destroy_super() in some cases with that value
unset. That seems to be OK in almost all cases, but we had a fire-drill
recently with some RHEL-only patches that oopsed because the s_type was
unset when destroy_super() got called.

Move the setting of the s_type into alloc_super() as a defensive coding
measure.

Cc: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 12f1237..080d60f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -218,6 +218,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 		s->s_shrink.seeks = DEFAULT_SEEKS;
 		s->s_shrink.shrink = prune_super;
 		s->s_shrink.batch = 1024;
+		s->s_type = type;
 	}
 out:
 	return s;
@@ -487,7 +488,6 @@ retry:
 		destroy_super(s);
 		return ERR_PTR(err);
 	}
-	s->s_type = type;
 	strlcpy(s->s_id, type->name, sizeof(s->s_id));
 	list_add_tail(&s->s_list, &super_blocks);
 	hlist_add_head(&s->s_instances, &type->fs_supers);
-- 
1.7.11.7


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

* Re: [PATCH] vfs: set s_type in alloc_super()
  2013-01-30  0:16 [PATCH] vfs: set s_type in alloc_super() Jeff Layton
@ 2013-01-30 15:08 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2013-01-30 15:08 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-fsdevel, sandeen

On Tue, Jan 29, 2013 at 07:16:11PM -0500, Jeff Layton wrote:
> I see no reason to wait until after the "set" operation returns to set
> the s_type. We do call destroy_super() in some cases with that value
> unset. That seems to be OK in almost all cases, but we had a fire-drill
> recently with some RHEL-only patches that oopsed because the s_type was
> unset when destroy_super() got called.
> 
> Move the setting of the s_type into alloc_super() as a defensive coding
> measure.

	NAK.  If anything, I'm seriously tempted to zero ->s_type in
deactivate_locked_super() just before we do put_filesystem_type() and
that reference becomes garbage.

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

end of thread, other threads:[~2013-01-30 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30  0:16 [PATCH] vfs: set s_type in alloc_super() Jeff Layton
2013-01-30 15:08 ` Al Viro

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