aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/cnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coda/cnode.c')
-rw-r--r--fs/coda/cnode.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index a7a780929eec..602240569c89 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -45,13 +45,15 @@ static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr)
45static int coda_test_inode(struct inode *inode, void *data) 45static int coda_test_inode(struct inode *inode, void *data)
46{ 46{
47 struct CodaFid *fid = (struct CodaFid *)data; 47 struct CodaFid *fid = (struct CodaFid *)data;
48 return coda_fideq(&(ITOC(inode)->c_fid), fid); 48 struct coda_inode_info *cii = ITOC(inode);
49 return coda_fideq(&cii->c_fid, fid);
49} 50}
50 51
51static int coda_set_inode(struct inode *inode, void *data) 52static int coda_set_inode(struct inode *inode, void *data)
52{ 53{
53 struct CodaFid *fid = (struct CodaFid *)data; 54 struct CodaFid *fid = (struct CodaFid *)data;
54 ITOC(inode)->c_fid = *fid; 55 struct coda_inode_info *cii = ITOC(inode);
56 cii->c_fid = *fid;
55 return 0; 57 return 0;
56} 58}
57 59
@@ -71,6 +73,7 @@ struct inode * coda_iget(struct super_block * sb, struct CodaFid * fid,
71 cii = ITOC(inode); 73 cii = ITOC(inode);
72 /* we still need to set i_ino for things like stat(2) */ 74 /* we still need to set i_ino for things like stat(2) */
73 inode->i_ino = hash; 75 inode->i_ino = hash;
76 /* inode is locked and unique, no need to grab cii->c_lock */
74 cii->c_mapcount = 0; 77 cii->c_mapcount = 0;
75 unlock_new_inode(inode); 78 unlock_new_inode(inode);
76 } 79 }
@@ -107,14 +110,20 @@ int coda_cnode_make(struct inode **inode, struct CodaFid *fid, struct super_bloc
107} 110}
108 111
109 112
113/* Although we treat Coda file identifiers as immutable, there is one
114 * special case for files created during a disconnection where they may
115 * not be globally unique. When an identifier collision is detected we
116 * first try to flush the cached inode from the kernel and finally
117 * resort to renaming/rehashing in-place. Userspace remembers both old
118 * and new values of the identifier to handle any in-flight upcalls.
119 * The real solution is to use globally unique UUIDs as identifiers, but
120 * retrofitting the existing userspace code for this is non-trivial. */
110void coda_replace_fid(struct inode *inode, struct CodaFid *oldfid, 121void coda_replace_fid(struct inode *inode, struct CodaFid *oldfid,
111 struct CodaFid *newfid) 122 struct CodaFid *newfid)
112{ 123{
113 struct coda_inode_info *cii; 124 struct coda_inode_info *cii = ITOC(inode);
114 unsigned long hash = coda_f2i(newfid); 125 unsigned long hash = coda_f2i(newfid);
115 126
116 cii = ITOC(inode);
117
118 BUG_ON(!coda_fideq(&cii->c_fid, oldfid)); 127 BUG_ON(!coda_fideq(&cii->c_fid, oldfid));
119 128
120 /* replace fid and rehash inode */ 129 /* replace fid and rehash inode */