diff options
-rw-r--r-- | fs/cifs/cifsfs.c | 8 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 1 | ||||
-rw-r--r-- | fs/cifs/inode.c | 22 |
3 files changed, 24 insertions, 7 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index e9f4ec701092..fcc434227691 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -147,10 +147,11 @@ cifs_read_super(struct super_block *sb, void *data, | |||
147 | #endif | 147 | #endif |
148 | sb->s_blocksize = CIFS_MAX_MSGSIZE; | 148 | sb->s_blocksize = CIFS_MAX_MSGSIZE; |
149 | sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ | 149 | sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ |
150 | inode = iget(sb, ROOT_I); | 150 | inode = cifs_iget(sb, ROOT_I); |
151 | 151 | ||
152 | if (!inode) { | 152 | if (IS_ERR(inode)) { |
153 | rc = -ENOMEM; | 153 | rc = PTR_ERR(inode); |
154 | inode = NULL; | ||
154 | goto out_no_root; | 155 | goto out_no_root; |
155 | } | 156 | } |
156 | 157 | ||
@@ -520,7 +521,6 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data) | |||
520 | } | 521 | } |
521 | 522 | ||
522 | static const struct super_operations cifs_super_ops = { | 523 | static const struct super_operations cifs_super_ops = { |
523 | .read_inode = cifs_read_inode, | ||
524 | .put_super = cifs_put_super, | 524 | .put_super = cifs_put_super, |
525 | .statfs = cifs_statfs, | 525 | .statfs = cifs_statfs, |
526 | .alloc_inode = cifs_alloc_inode, | 526 | .alloc_inode = cifs_alloc_inode, |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 195b14de5567..68978306c3ca 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -44,6 +44,7 @@ extern void cifs_read_inode(struct inode *); | |||
44 | 44 | ||
45 | /* Functions related to inodes */ | 45 | /* Functions related to inodes */ |
46 | extern const struct inode_operations cifs_dir_inode_ops; | 46 | extern const struct inode_operations cifs_dir_inode_ops; |
47 | extern struct inode *cifs_iget(struct super_block *, unsigned long); | ||
47 | extern int cifs_create(struct inode *, struct dentry *, int, | 48 | extern int cifs_create(struct inode *, struct dentry *, int, |
48 | struct nameidata *); | 49 | struct nameidata *); |
49 | extern struct dentry *cifs_lookup(struct inode *, struct dentry *, | 50 | extern struct dentry *cifs_lookup(struct inode *, struct dentry *, |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 47f2621001e4..b1a4a65eaa08 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -586,10 +586,18 @@ static const struct inode_operations cifs_ipc_inode_ops = { | |||
586 | }; | 586 | }; |
587 | 587 | ||
588 | /* gets root inode */ | 588 | /* gets root inode */ |
589 | void cifs_read_inode(struct inode *inode) | 589 | struct inode *cifs_iget(struct super_block *sb, unsigned long ino) |
590 | { | 590 | { |
591 | int xid, rc; | 591 | int xid; |
592 | struct cifs_sb_info *cifs_sb; | 592 | struct cifs_sb_info *cifs_sb; |
593 | struct inode *inode; | ||
594 | long rc; | ||
595 | |||
596 | inode = iget_locked(sb, ino); | ||
597 | if (!inode) | ||
598 | return ERR_PTR(-ENOMEM); | ||
599 | if (!(inode->i_state & I_NEW)) | ||
600 | return inode; | ||
593 | 601 | ||
594 | cifs_sb = CIFS_SB(inode->i_sb); | 602 | cifs_sb = CIFS_SB(inode->i_sb); |
595 | xid = GetXid(); | 603 | xid = GetXid(); |
@@ -606,10 +614,18 @@ void cifs_read_inode(struct inode *inode) | |||
606 | inode->i_fop = &simple_dir_operations; | 614 | inode->i_fop = &simple_dir_operations; |
607 | inode->i_uid = cifs_sb->mnt_uid; | 615 | inode->i_uid = cifs_sb->mnt_uid; |
608 | inode->i_gid = cifs_sb->mnt_gid; | 616 | inode->i_gid = cifs_sb->mnt_gid; |
617 | _FreeXid(xid); | ||
618 | iget_failed(inode); | ||
619 | return ERR_PTR(rc); | ||
609 | } | 620 | } |
610 | 621 | ||
611 | /* can not call macro FreeXid here since in a void func */ | 622 | unlock_new_inode(inode); |
623 | |||
624 | /* can not call macro FreeXid here since in a void func | ||
625 | * TODO: This is no longer true | ||
626 | */ | ||
612 | _FreeXid(xid); | 627 | _FreeXid(xid); |
628 | return inode; | ||
613 | } | 629 | } |
614 | 630 | ||
615 | int cifs_unlink(struct inode *inode, struct dentry *direntry) | 631 | int cifs_unlink(struct inode *inode, struct dentry *direntry) |