diff options
Diffstat (limited to 'fs/afs/inode.c')
-rw-r--r-- | fs/afs/inode.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 9c984cc42cc9..515a5d12d8fb 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
@@ -209,7 +209,7 @@ bad_inode: | |||
209 | */ | 209 | */ |
210 | void afs_zap_data(struct afs_vnode *vnode) | 210 | void afs_zap_data(struct afs_vnode *vnode) |
211 | { | 211 | { |
212 | kenter("zap data {%x:%u}", vnode->fid.vid, vnode->fid.vnode); | 212 | _enter("zap data {%x:%u}", vnode->fid.vid, vnode->fid.vnode); |
213 | 213 | ||
214 | /* nuke all the non-dirty pages that aren't locked, mapped or being | 214 | /* nuke all the non-dirty pages that aren't locked, mapped or being |
215 | * written back */ | 215 | * written back */ |
@@ -334,6 +334,7 @@ void afs_clear_inode(struct inode *inode) | |||
334 | vnode->server = NULL; | 334 | vnode->server = NULL; |
335 | } | 335 | } |
336 | 336 | ||
337 | ASSERT(list_empty(&vnode->writebacks)); | ||
337 | ASSERT(!vnode->cb_promised); | 338 | ASSERT(!vnode->cb_promised); |
338 | 339 | ||
339 | #ifdef AFS_CACHING_SUPPORT | 340 | #ifdef AFS_CACHING_SUPPORT |
@@ -350,3 +351,47 @@ void afs_clear_inode(struct inode *inode) | |||
350 | 351 | ||
351 | _leave(""); | 352 | _leave(""); |
352 | } | 353 | } |
354 | |||
355 | /* | ||
356 | * set the attributes of an inode | ||
357 | */ | ||
358 | int afs_setattr(struct dentry *dentry, struct iattr *attr) | ||
359 | { | ||
360 | struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); | ||
361 | struct key *key; | ||
362 | int ret; | ||
363 | |||
364 | _enter("{%x:%u},{n=%s},%x", | ||
365 | vnode->fid.vid, vnode->fid.vnode, dentry->d_name.name, | ||
366 | attr->ia_valid); | ||
367 | |||
368 | if (!(attr->ia_valid & (ATTR_SIZE | ATTR_MODE | ATTR_UID | ATTR_GID | | ||
369 | ATTR_MTIME))) { | ||
370 | _leave(" = 0 [unsupported]"); | ||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | /* flush any dirty data outstanding on a regular file */ | ||
375 | if (S_ISREG(vnode->vfs_inode.i_mode)) { | ||
376 | filemap_write_and_wait(vnode->vfs_inode.i_mapping); | ||
377 | afs_writeback_all(vnode); | ||
378 | } | ||
379 | |||
380 | if (attr->ia_valid & ATTR_FILE) { | ||
381 | key = attr->ia_file->private_data; | ||
382 | } else { | ||
383 | key = afs_request_key(vnode->volume->cell); | ||
384 | if (IS_ERR(key)) { | ||
385 | ret = PTR_ERR(key); | ||
386 | goto error; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | ret = afs_vnode_setattr(vnode, key, attr); | ||
391 | if (!(attr->ia_valid & ATTR_FILE)) | ||
392 | key_put(key); | ||
393 | |||
394 | error: | ||
395 | _leave(" = %d", ret); | ||
396 | return ret; | ||
397 | } | ||