* [PATCH 3/3] pipefs and sockfs respin -- make .drop_inode = generic_delete_inode
@ 2007-01-22 14:16 Jeff Layton
2007-01-22 20:49 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2007-01-22 14:16 UTC (permalink / raw)
To: linux-fsdevel; +Cc: esandeen, viro
A little late since I sent some patches to akpm already, but I'm thinking
that this might be the better way to go. Rather than trying to have the
filesystems manage i_nlink, just make drop_inode for the filesystems be
generic_delete_inode. It seems that some filesystems already do that, and it
seems like that should do the right thing here too. This seems to be a little
easier to follow than messing with i_nlink.
Does this seem reasonable? If so, I'll send this on to akpm and ask him to
commit this rather than the original pipefs patch I sent.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
diff --git a/fs/pipe.c b/fs/pipe.c
index 68090e8..9b3cb34 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -871,6 +871,8 @@ static struct inode * get_pipe_inode(void)
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_ino = iunique(pipe_mnt->mnt_sb, 1);
+ insert_inode_hash(inode);
return inode;
@@ -1003,6 +1005,11 @@ int do_pipe(int *fd)
return error;
}
+static struct super_operations pipefs_sops = {
+ .statfs = simple_statfs,
+ .drop_inode = generic_delete_inode,
+};
+
/*
* pipefs should _never_ be mounted by userland - too much of security hassle,
* no real gain from having the whole whorehouse mounted. So we don't need
@@ -1013,7 +1020,7 @@ static int pipefs_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data,
struct vfsmount *mnt)
{
- return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC, mnt);
+ return get_sb_pseudo(fs_type, "pipe:", &pipefs_sops, PIPEFS_MAGIC, mnt);
}
static struct file_system_type pipe_fs_type = {
diff --git a/net/socket.c b/net/socket.c
index 4e39631..20193a8 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -284,6 +284,7 @@ static int init_inodecache(void)
static struct super_operations sockfs_ops = {
.alloc_inode = sock_alloc_inode,
.destroy_inode =sock_destroy_inode,
+ .drop_inode = generic_delete_inode,
.statfs = simple_statfs,
};
@@ -495,6 +496,8 @@ static struct socket *sock_alloc(void)
inode->i_mode = S_IFSOCK | S_IRWXUGO;
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
+ inode->i_ino = iunique(sock_mnt->mnt_sb, 1);
+ insert_inode_hash(inode);
get_cpu_var(sockets_in_use)++;
put_cpu_var(sockets_in_use);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/3] pipefs and sockfs respin -- make .drop_inode = generic_delete_inode
2007-01-22 14:16 [PATCH 3/3] pipefs and sockfs respin -- make .drop_inode = generic_delete_inode Jeff Layton
@ 2007-01-22 20:49 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2007-01-22 20:49 UTC (permalink / raw)
To: Jeff Layton; +Cc: linux-fsdevel, esandeen, viro
On Mon, Jan 22, 2007 at 09:16:06AM -0500, Jeff Layton wrote:
> A little late since I sent some patches to akpm already, but I'm thinking
> that this might be the better way to go. Rather than trying to have the
> filesystems manage i_nlink, just make drop_inode for the filesystems be
> generic_delete_inode. It seems that some filesystems already do that, and it
> seems like that should do the right thing here too. This seems to be a little
> easier to follow than messing with i_nlink.
>
> Does this seem reasonable? If so, I'll send this on to akpm and ask him to
> commit this rather than the original pipefs patch I sent.
Sounds good to me.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-22 20:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-22 14:16 [PATCH 3/3] pipefs and sockfs respin -- make .drop_inode = generic_delete_inode Jeff Layton
2007-01-22 20:49 ` Christoph Hellwig
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).