linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] hostfs: tweaks from imgdafs review
@ 2013-03-27 10:47 James Hogan
  2013-03-27 10:47 ` [PATCH 1/3] hostfs: remove "will unlock" comment James Hogan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 10:47 UTC (permalink / raw)
  To: Jeff Dike, Al Viro, Richard Weinberger, user-mode-linux-devel,
	linux-kernel
  Cc: James Hogan

This patchset contains some tweaks to hostfs, based on imgdafs review
comments from Al Viro which also apply to hostfs.

James Hogan (3):
  hostfs: remove "will unlock" comment
  hostfs: move HOSTFS_SUPER_MAGIC to <linux/magic.h>
  hostfs: use kmalloc instead of kzalloc

 fs/hostfs/hostfs_kern.c    | 8 ++++----
 include/uapi/linux/magic.h | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
1.8.1.2



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

* [PATCH 1/3] hostfs: remove "will unlock" comment
  2013-03-27 10:47 [PATCH 0/3] hostfs: tweaks from imgdafs review James Hogan
@ 2013-03-27 10:47 ` James Hogan
  2013-03-27 10:47 ` [PATCH 2/3] hostfs: move HOSTFS_SUPER_MAGIC to <linux/magic.h> James Hogan
  2013-03-27 10:47 ` [PATCH 3/3] hostfs: use kmalloc instead of kzalloc James Hogan
  2 siblings, 0 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 10:47 UTC (permalink / raw)
  To: Jeff Dike, Al Viro, Richard Weinberger, user-mode-linux-devel,
	linux-kernel
  Cc: James Hogan, Nick Piggin

A "will unlock" comment was added to hostfs in the following commit,
along with a spinlock:

Commit e9193059b1b3733695d5b80e667778311695aa73 ("hostfs: fix races in
dentry_name() and inode_name()").

But the spinlock was subsequently removed in the following commit:

Commit ec2447c278ee973d35f38e53ca16ba7f965ae33d ("hostfs: simplify
locking").

Since the comment is no longer applicable, remove it.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Nick Piggin <npiggin@kernel.dk>
---
 fs/hostfs/hostfs_kern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 0f6e52d..95b9c87 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -121,7 +121,7 @@ static char *dentry_name(struct dentry *dentry)
 	if (!name)
 		return NULL;
 
-	return __dentry_name(dentry, name); /* will unlock */
+	return __dentry_name(dentry, name);
 }
 
 static char *inode_name(struct inode *ino)
-- 
1.8.1.2



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

* [PATCH 2/3] hostfs: move HOSTFS_SUPER_MAGIC to <linux/magic.h>
  2013-03-27 10:47 [PATCH 0/3] hostfs: tweaks from imgdafs review James Hogan
  2013-03-27 10:47 ` [PATCH 1/3] hostfs: remove "will unlock" comment James Hogan
@ 2013-03-27 10:47 ` James Hogan
  2013-03-27 10:47 ` [PATCH 3/3] hostfs: use kmalloc instead of kzalloc James Hogan
  2 siblings, 0 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 10:47 UTC (permalink / raw)
  To: Jeff Dike, Al Viro, Richard Weinberger, user-mode-linux-devel,
	linux-kernel
  Cc: James Hogan

Move HOSTFS_SUPER_MAGIC to <linux/magic.h> to be with it's magical
friends from other file systems.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 fs/hostfs/hostfs_kern.c    | 3 +--
 include/uapi/linux/magic.h | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 95b9c87..f2372ef 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/fs.h>
+#include <linux/magic.h>
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/pagemap.h>
@@ -45,8 +46,6 @@ static const struct dentry_operations hostfs_dentry_ops = {
 static char *root_ino = "";
 static int append = 0;
 
-#define HOSTFS_SUPER_MAGIC 0x00c0ffee
-
 static const struct inode_operations hostfs_iops;
 static const struct inode_operations hostfs_dir_iops;
 static const struct inode_operations hostfs_link_iops;
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index 873e086..cebb124 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -29,6 +29,7 @@
 #define JFFS2_SUPER_MAGIC	0x72b6
 #define PSTOREFS_MAGIC		0x6165676C
 #define EFIVARFS_MAGIC		0xde5e81e4
+#define HOSTFS_SUPER_MAGIC	0x00c0ffee
 
 #define MINIX_SUPER_MAGIC	0x137F		/* minix v1 fs, 14 char names */
 #define MINIX_SUPER_MAGIC2	0x138F		/* minix v1 fs, 30 char names */
-- 
1.8.1.2



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

* [PATCH 3/3] hostfs: use kmalloc instead of kzalloc
  2013-03-27 10:47 [PATCH 0/3] hostfs: tweaks from imgdafs review James Hogan
  2013-03-27 10:47 ` [PATCH 1/3] hostfs: remove "will unlock" comment James Hogan
  2013-03-27 10:47 ` [PATCH 2/3] hostfs: move HOSTFS_SUPER_MAGIC to <linux/magic.h> James Hogan
@ 2013-03-27 10:47 ` James Hogan
  2 siblings, 0 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 10:47 UTC (permalink / raw)
  To: Jeff Dike, Al Viro, Richard Weinberger, user-mode-linux-devel,
	linux-kernel
  Cc: James Hogan

The inode info structure is zeroed at allocation with kzalloc, and then
all but one of the fields (including the largest, vfs_inode) are
initialised explicitly. Switch to using kmalloc and initialise the
remaining field too.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 fs/hostfs/hostfs_kern.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index f2372ef..32f35f1 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -228,10 +228,11 @@ static struct inode *hostfs_alloc_inode(struct super_block *sb)
 {
 	struct hostfs_inode_info *hi;
 
-	hi = kzalloc(sizeof(*hi), GFP_KERNEL);
+	hi = kmalloc(sizeof(*hi), GFP_KERNEL);
 	if (hi == NULL)
 		return NULL;
 	hi->fd = -1;
+	hi->mode = 0;
 	inode_init_once(&hi->vfs_inode);
 	return &hi->vfs_inode;
 }
-- 
1.8.1.2



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

end of thread, other threads:[~2013-03-27 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-27 10:47 [PATCH 0/3] hostfs: tweaks from imgdafs review James Hogan
2013-03-27 10:47 ` [PATCH 1/3] hostfs: remove "will unlock" comment James Hogan
2013-03-27 10:47 ` [PATCH 2/3] hostfs: move HOSTFS_SUPER_MAGIC to <linux/magic.h> James Hogan
2013-03-27 10:47 ` [PATCH 3/3] hostfs: use kmalloc instead of kzalloc James Hogan

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