]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
iget: stop CIFS from using iget() and read_inode()
authorDavid Howells <dhowells@redhat.com>
Thu, 7 Feb 2008 08:15:33 +0000 (00:15 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:27 +0000 (08:42 -0800)
Stop the CIFS filesystem from using iget() and read_inode().  Replace
cifs_read_inode() with cifs_iget(), and call that instead of iget().
cifs_iget() then uses iget_locked() directly and returns a proper error code
instead of an inode in the event of an error.

cifs_read_super() now returns any error incurred when getting the root inode
instead of ENOMEM.

cifs_iget() needs examining.  The comment "can not call macro FreeXid here
since in a void func" is no longer true.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Steven French <sfrench@us.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/cifs/cifsfs.c
fs/cifs/cifsfs.h
fs/cifs/inode.c

index e9f4ec7010926fb76e4808d3e4ed1bd0ab7f7cb5..fcc434227691fe4cbd57d2d74b7780c0767804fb 100644 (file)
@@ -147,10 +147,11 @@ cifs_read_super(struct super_block *sb, void *data,
 #endif
        sb->s_blocksize = CIFS_MAX_MSGSIZE;
        sb->s_blocksize_bits = 14;      /* default 2**14 = CIFS_MAX_MSGSIZE */
-       inode = iget(sb, ROOT_I);
+       inode = cifs_iget(sb, ROOT_I);
 
-       if (!inode) {
-               rc = -ENOMEM;
+       if (IS_ERR(inode)) {
+               rc = PTR_ERR(inode);
+               inode = NULL;
                goto out_no_root;
        }
 
@@ -520,7 +521,6 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data)
 }
 
 static const struct super_operations cifs_super_ops = {
-       .read_inode = cifs_read_inode,
        .put_super = cifs_put_super,
        .statfs = cifs_statfs,
        .alloc_inode = cifs_alloc_inode,
index 195b14de5567a17e4178e1846c27cab24036d4d8..68978306c3cad4333e7db69aa19e5eb7d1e89dfe 100644 (file)
@@ -44,6 +44,7 @@ extern void cifs_read_inode(struct inode *);
 
 /* Functions related to inodes */
 extern const struct inode_operations cifs_dir_inode_ops;
+extern struct inode *cifs_iget(struct super_block *, unsigned long);
 extern int cifs_create(struct inode *, struct dentry *, int,
                       struct nameidata *);
 extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
index 47f2621001e4e09069c2c390f77fb95a4d3dd15f..b1a4a65eaa08e0b24f1c1daf83700113f38a742b 100644 (file)
@@ -586,10 +586,18 @@ static const struct inode_operations cifs_ipc_inode_ops = {
 };
 
 /* gets root inode */
-void cifs_read_inode(struct inode *inode)
+struct inode *cifs_iget(struct super_block *sb, unsigned long ino)
 {
-       int xid, rc;
+       int xid;
        struct cifs_sb_info *cifs_sb;
+       struct inode *inode;
+       long rc;
+
+       inode = iget_locked(sb, ino);
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
+       if (!(inode->i_state & I_NEW))
+               return inode;
 
        cifs_sb = CIFS_SB(inode->i_sb);
        xid = GetXid();
@@ -606,10 +614,18 @@ void cifs_read_inode(struct inode *inode)
                inode->i_fop = &simple_dir_operations;
                inode->i_uid = cifs_sb->mnt_uid;
                inode->i_gid = cifs_sb->mnt_gid;
+               _FreeXid(xid);
+               iget_failed(inode);
+               return ERR_PTR(rc);
        }
 
-       /* can not call macro FreeXid here since in a void func */
+       unlock_new_inode(inode);
+
+       /* can not call macro FreeXid here since in a void func
+        * TODO: This is no longer true
+        */
        _FreeXid(xid);
+       return inode;
 }
 
 int cifs_unlink(struct inode *inode, struct dentry *direntry)