From: Miklos Szeredi <mszeredi@suse.cz>
Pass the open file into the filesystem's ->getattr() method for
fstat().
This is needed to be able to correctly implement open-unlink-fstat
semantics in some filesystem such as sshfs, without having to resort
to "silly-renaming".
Do this by adding a 'struct file *' parameter to i_op->getattr(). For
fstat() pass the open file pointer, in other cases pass NULL.
This is safe from a compatibility standpoint, out-of-tree old stuff
will continue to work, but will get a warning at compile time.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Index: linux/fs/9p/vfs_inode.c
===================================================================
--- linux.orig/fs/9p/vfs_inode.c 2007-09-21 14:08:25.000000000 +0200
+++ linux/fs/9p/vfs_inode.c 2007-09-21 14:08:40.000000000 +0200
@@ -706,7 +706,7 @@ done:
static int
v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
- struct kstat *stat)
+ struct kstat *stat, struct file *file)
{
int err;
struct v9fs_session_info *v9ses;
@@ -717,7 +717,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, s
err = -EPERM;
v9ses = v9fs_inode2v9ses(dentry->d_inode);
if (v9ses->cache == CACHE_LOOSE)
- return simple_getattr(mnt, dentry, stat);
+ return simple_getattr(mnt, dentry, stat, file);
fid = v9fs_fid_lookup(dentry);
if (IS_ERR(fid))
Index: linux/fs/afs/inode.c
===================================================================
--- linux.orig/fs/afs/inode.c 2007-09-21 14:08:25.000000000 +0200
+++ linux/fs/afs/inode.c 2007-09-21 14:08:40.000000000 +0200
@@ -295,7 +295,7 @@ error_unlock:
* read the attributes of an inode
*/
int afs_getattr(struct vfsmount *mnt, struct dentry *dentry,
- struct kstat *stat)
+ struct kstat *stat, struct file *file)
{
struct inode *inode;
Index: linux/fs/afs/internal.h
===================================================================
--- linux.orig/fs/afs/internal.h 2007-09-21 14:08:25.0...It's not much of an inode operation anymore if you need to pass a file to it... Since the attributes are really part of the inode and not the file, this seems like a bit of a hack. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc. -
Well, the data is part of the inode and not the file as well. So why are read/write special? OK, I realize now, that with special files (device, fifo) the I/O is actually on the open file and _not_ on the inode. So the above is only true for regular files. And so it really would make sense to make a separate fgetattr() file operation, so we only get it for regular files and not for special files. Because for the specail file case it really doesn't make sense to pass the file pointer to the filesystem, since the filesystem knows nothing about the open file. Miklos -
| Greg Kroah-Hartman | [PATCH 019/196] DMA: Convert from class_device to device for DMA engine |
| Tejun Heo | [PATCH 4/7] FUSE: implement direct lseek support |
| Parag Warudkar | BUG: soft lockup - CPU#1 stuck for 15s! [swapper:0] |
| Greg Smith | PostgreSQL pgbench performance regression in 2.6.23+ |
git: | |
| Len Brown | fatal: unable to create '.git/index': File exists |
| Dan Farina | backup or mirror a repository |
| André Goddard Rosa | Using kdiff3 to compare two different revisions of a folder |
| Petko Manolov | git and binary files |
| Richard Stallman | Real men don't attack straw men |
| Steve B | Intel Atom and D945GCLF2 |
| Jeff Ross | U320 Drive on U160 controller? |
| Sunnz | How do I configure sendmail? |
| Eric Dumazet | [PATCH] fs: pipe/sockets/anon dentries should not have a parent |
| Denys Fedoryshchenko | thousands of classes, e1000 TX unit hang |
| Wei Yongjun | [PATCH] xfrm: Fix kernel panic when flush and dump SPD entries |
| Steffen Klassert | [RFC PATCH 4/5] crypto: allow allocation of percpu crypto transforms |
