diff options
author | Latchesar Ionkov <lucho@ionkov.net> | 2006-03-02 05:54:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-02 11:33:07 -0500 |
commit | 6a3124a3946c16159c3faf83e62ffdb5d1134b3a (patch) | |
tree | 989f1e89ed0971824db973af5347b879e12c67cd /fs/9p/vfs_super.c | |
parent | 77a3313551afd53c90012e5a87f7f2b2195fc67e (diff) |
[PATCH] v9fs: fix atomic create open
In order to assure atomic create+open v9fs stores the open fid produced by
v9fs_vfs_create in the dentry, from where v9fs_file_open retrieves it and
associates it with the open file.
This patch modifies v9fs to use nameidata.intent.open values to do the atomic
create+open.
Signed-off-by: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/9p/vfs_super.c')
-rw-r--r-- | fs/9p/vfs_super.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 2c4fa75be025..0c85872be51a 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -146,7 +146,6 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
146 | inode->i_gid = gid; | 146 | inode->i_gid = gid; |
147 | 147 | ||
148 | root = d_alloc_root(inode); | 148 | root = d_alloc_root(inode); |
149 | |||
150 | if (!root) { | 149 | if (!root) { |
151 | retval = -ENOMEM; | 150 | retval = -ENOMEM; |
152 | goto put_back_sb; | 151 | goto put_back_sb; |
@@ -157,24 +156,27 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
157 | stat_result = v9fs_t_stat(v9ses, newfid, &fcall); | 156 | stat_result = v9fs_t_stat(v9ses, newfid, &fcall); |
158 | if (stat_result < 0) { | 157 | if (stat_result < 0) { |
159 | dprintk(DEBUG_ERROR, "stat error\n"); | 158 | dprintk(DEBUG_ERROR, "stat error\n"); |
159 | kfree(fcall); | ||
160 | v9fs_t_clunk(v9ses, newfid); | 160 | v9fs_t_clunk(v9ses, newfid); |
161 | v9fs_put_idpool(newfid, &v9ses->fidpool); | ||
162 | } else { | 161 | } else { |
163 | /* Setup the Root Inode */ | 162 | /* Setup the Root Inode */ |
164 | root_fid = v9fs_fid_create(root, v9ses, newfid, 0); | 163 | kfree(fcall); |
164 | root_fid = v9fs_fid_create(v9ses, newfid); | ||
165 | if (root_fid == NULL) { | 165 | if (root_fid == NULL) { |
166 | retval = -ENOMEM; | 166 | retval = -ENOMEM; |
167 | goto put_back_sb; | 167 | goto put_back_sb; |
168 | } | 168 | } |
169 | 169 | ||
170 | retval = v9fs_fid_insert(root_fid, root); | ||
171 | if (retval < 0) | ||
172 | goto put_back_sb; | ||
173 | |||
170 | root_fid->qid = fcall->params.rstat.stat.qid; | 174 | root_fid->qid = fcall->params.rstat.stat.qid; |
171 | root->d_inode->i_ino = | 175 | root->d_inode->i_ino = |
172 | v9fs_qid2ino(&fcall->params.rstat.stat.qid); | 176 | v9fs_qid2ino(&fcall->params.rstat.stat.qid); |
173 | v9fs_stat2inode(&fcall->params.rstat.stat, root->d_inode, sb); | 177 | v9fs_stat2inode(&fcall->params.rstat.stat, root->d_inode, sb); |
174 | } | 178 | } |
175 | 179 | ||
176 | kfree(fcall); | ||
177 | |||
178 | if (stat_result < 0) { | 180 | if (stat_result < 0) { |
179 | retval = stat_result; | 181 | retval = stat_result; |
180 | goto put_back_sb; | 182 | goto put_back_sb; |