diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/attr.c | 9 | ||||
-rw-r--r-- | fs/libfs.c | 16 |
2 files changed, 14 insertions, 11 deletions
@@ -237,13 +237,10 @@ int notify_change(struct dentry * dentry, struct iattr * attr) | |||
237 | if (ia_valid & ATTR_SIZE) | 237 | if (ia_valid & ATTR_SIZE) |
238 | down_write(&dentry->d_inode->i_alloc_sem); | 238 | down_write(&dentry->d_inode->i_alloc_sem); |
239 | 239 | ||
240 | if (inode->i_op && inode->i_op->setattr) { | 240 | if (inode->i_op->setattr) |
241 | error = inode->i_op->setattr(dentry, attr); | 241 | error = inode->i_op->setattr(dentry, attr); |
242 | } else { | 242 | else |
243 | error = inode_change_ok(inode, attr); | 243 | error = simple_setattr(dentry, attr); |
244 | if (!error) | ||
245 | error = inode_setattr(inode, attr); | ||
246 | } | ||
247 | 244 | ||
248 | if (ia_valid & ATTR_SIZE) | 245 | if (ia_valid & ATTR_SIZE) |
249 | up_write(&dentry->d_inode->i_alloc_sem); | 246 | up_write(&dentry->d_inode->i_alloc_sem); |
diff --git a/fs/libfs.c b/fs/libfs.c index 861a88797716..40562224b718 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -370,21 +370,26 @@ int simple_setsize(struct inode *inode, loff_t newsize) | |||
370 | EXPORT_SYMBOL(simple_setsize); | 370 | EXPORT_SYMBOL(simple_setsize); |
371 | 371 | ||
372 | /** | 372 | /** |
373 | * simple_setattr - setattr for simple in-memory filesystem | 373 | * simple_setattr - setattr for simple filesystem |
374 | * @dentry: dentry | 374 | * @dentry: dentry |
375 | * @iattr: iattr structure | 375 | * @iattr: iattr structure |
376 | * | 376 | * |
377 | * Returns 0 on success, -error on failure. | 377 | * Returns 0 on success, -error on failure. |
378 | * | 378 | * |
379 | * simple_setattr implements setattr for an in-memory filesystem which | 379 | * simple_setattr is a simple ->setattr implementation without a proper |
380 | * does not store its own file data or metadata (eg. uses the page cache | 380 | * implementation of size changes. |
381 | * and inode cache as its data store). | 381 | * |
382 | * It can either be used for in-memory filesystems or special files | ||
383 | * on simple regular filesystems. Anything that needs to change on-disk | ||
384 | * or wire state on size changes needs its own setattr method. | ||
382 | */ | 385 | */ |
383 | int simple_setattr(struct dentry *dentry, struct iattr *iattr) | 386 | int simple_setattr(struct dentry *dentry, struct iattr *iattr) |
384 | { | 387 | { |
385 | struct inode *inode = dentry->d_inode; | 388 | struct inode *inode = dentry->d_inode; |
386 | int error; | 389 | int error; |
387 | 390 | ||
391 | WARN_ON_ONCE(inode->i_op->truncate); | ||
392 | |||
388 | error = inode_change_ok(inode, iattr); | 393 | error = inode_change_ok(inode, iattr); |
389 | if (error) | 394 | if (error) |
390 | return error; | 395 | return error; |
@@ -396,7 +401,8 @@ int simple_setattr(struct dentry *dentry, struct iattr *iattr) | |||
396 | } | 401 | } |
397 | 402 | ||
398 | setattr_copy(inode, iattr); | 403 | setattr_copy(inode, iattr); |
399 | return error; | 404 | mark_inode_dirty(inode); |
405 | return 0; | ||
400 | } | 406 | } |
401 | EXPORT_SYMBOL(simple_setattr); | 407 | EXPORT_SYMBOL(simple_setattr); |
402 | 408 | ||