diff options
Diffstat (limited to 'fs/exofs')
-rw-r--r-- | fs/exofs/osd.c | 4 | ||||
-rw-r--r-- | fs/exofs/super.c | 25 |
2 files changed, 24 insertions, 5 deletions
diff --git a/fs/exofs/osd.c b/fs/exofs/osd.c index 48cc4d11d3fb..b3d2ccb87aaa 100644 --- a/fs/exofs/osd.c +++ b/fs/exofs/osd.c | |||
@@ -50,10 +50,10 @@ int exofs_check_ok_resid(struct osd_request *or, u64 *in_resid, u64 *out_resid) | |||
50 | 50 | ||
51 | /* FIXME: should be include in osd_sense_info */ | 51 | /* FIXME: should be include in osd_sense_info */ |
52 | if (in_resid) | 52 | if (in_resid) |
53 | *in_resid = or->in.req ? or->in.req->data_len : 0; | 53 | *in_resid = or->in.req ? or->in.req->resid_len : 0; |
54 | 54 | ||
55 | if (out_resid) | 55 | if (out_resid) |
56 | *out_resid = or->out.req ? or->out.req->data_len : 0; | 56 | *out_resid = or->out.req ? or->out.req->resid_len : 0; |
57 | 57 | ||
58 | return ret; | 58 | return ret; |
59 | } | 59 | } |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 9f1985e857e2..8216c5b77b53 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -200,20 +200,21 @@ static const struct export_operations exofs_export_ops; | |||
200 | /* | 200 | /* |
201 | * Write the superblock to the OSD | 201 | * Write the superblock to the OSD |
202 | */ | 202 | */ |
203 | static void exofs_write_super(struct super_block *sb) | 203 | static int exofs_sync_fs(struct super_block *sb, int wait) |
204 | { | 204 | { |
205 | struct exofs_sb_info *sbi; | 205 | struct exofs_sb_info *sbi; |
206 | struct exofs_fscb *fscb; | 206 | struct exofs_fscb *fscb; |
207 | struct osd_request *or; | 207 | struct osd_request *or; |
208 | struct osd_obj_id obj; | 208 | struct osd_obj_id obj; |
209 | int ret; | 209 | int ret = -ENOMEM; |
210 | 210 | ||
211 | fscb = kzalloc(sizeof(struct exofs_fscb), GFP_KERNEL); | 211 | fscb = kzalloc(sizeof(struct exofs_fscb), GFP_KERNEL); |
212 | if (!fscb) { | 212 | if (!fscb) { |
213 | EXOFS_ERR("exofs_write_super: memory allocation failed.\n"); | 213 | EXOFS_ERR("exofs_write_super: memory allocation failed.\n"); |
214 | return; | 214 | return -ENOMEM; |
215 | } | 215 | } |
216 | 216 | ||
217 | lock_super(sb); | ||
217 | lock_kernel(); | 218 | lock_kernel(); |
218 | sbi = sb->s_fs_info; | 219 | sbi = sb->s_fs_info; |
219 | fscb->s_nextid = cpu_to_le64(sbi->s_nextid); | 220 | fscb->s_nextid = cpu_to_le64(sbi->s_nextid); |
@@ -246,7 +247,17 @@ out: | |||
246 | if (or) | 247 | if (or) |
247 | osd_end_request(or); | 248 | osd_end_request(or); |
248 | unlock_kernel(); | 249 | unlock_kernel(); |
250 | unlock_super(sb); | ||
249 | kfree(fscb); | 251 | kfree(fscb); |
252 | return ret; | ||
253 | } | ||
254 | |||
255 | static void exofs_write_super(struct super_block *sb) | ||
256 | { | ||
257 | if (!(sb->s_flags & MS_RDONLY)) | ||
258 | exofs_sync_fs(sb, 1); | ||
259 | else | ||
260 | sb->s_dirt = 0; | ||
250 | } | 261 | } |
251 | 262 | ||
252 | /* | 263 | /* |
@@ -258,6 +269,11 @@ static void exofs_put_super(struct super_block *sb) | |||
258 | int num_pend; | 269 | int num_pend; |
259 | struct exofs_sb_info *sbi = sb->s_fs_info; | 270 | struct exofs_sb_info *sbi = sb->s_fs_info; |
260 | 271 | ||
272 | lock_kernel(); | ||
273 | |||
274 | if (sb->s_dirt) | ||
275 | exofs_write_super(sb); | ||
276 | |||
261 | /* make sure there are no pending commands */ | 277 | /* make sure there are no pending commands */ |
262 | for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0; | 278 | for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0; |
263 | num_pend = atomic_read(&sbi->s_curr_pending)) { | 279 | num_pend = atomic_read(&sbi->s_curr_pending)) { |
@@ -271,6 +287,8 @@ static void exofs_put_super(struct super_block *sb) | |||
271 | osduld_put_device(sbi->s_dev); | 287 | osduld_put_device(sbi->s_dev); |
272 | kfree(sb->s_fs_info); | 288 | kfree(sb->s_fs_info); |
273 | sb->s_fs_info = NULL; | 289 | sb->s_fs_info = NULL; |
290 | |||
291 | unlock_kernel(); | ||
274 | } | 292 | } |
275 | 293 | ||
276 | /* | 294 | /* |
@@ -484,6 +502,7 @@ static const struct super_operations exofs_sops = { | |||
484 | .delete_inode = exofs_delete_inode, | 502 | .delete_inode = exofs_delete_inode, |
485 | .put_super = exofs_put_super, | 503 | .put_super = exofs_put_super, |
486 | .write_super = exofs_write_super, | 504 | .write_super = exofs_write_super, |
505 | .sync_fs = exofs_sync_fs, | ||
487 | .statfs = exofs_statfs, | 506 | .statfs = exofs_statfs, |
488 | }; | 507 | }; |
489 | 508 | ||