Skip to content

Commit a27648c

Browse files
dhowellstorvalds
authored andcommitted
afs: Fix setting of mtime when creating a file/dir/symlink
kafs incorrectly passes a zero mtime (ie. 1st Jan 1970) to the server when creating a file, dir or symlink because the mtime recorded in the afs_operation struct gets passed to the server by the marshalling routines, but the afs_mkdir(), afs_create() and afs_symlink() functions don't set it. This gets masked if a file or directory is subsequently modified. Fix this by filling in op->mtime before calling the create op. Fixes: e49c7b2 ("afs: Build an abstraction around an "operation" concept") Signed-off-by: David Howells <[email protected]> Reviewed-by: Jeffrey Altman <[email protected]> Reviewed-by: Marc Dionne <[email protected]> cc: [email protected] cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent a4d7d70 commit a27648c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/afs/dir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,7 @@ static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
13581358
op->dentry = dentry;
13591359
op->create.mode = S_IFDIR | mode;
13601360
op->create.reason = afs_edit_dir_for_mkdir;
1361+
op->mtime = current_time(dir);
13611362
op->ops = &afs_mkdir_operation;
13621363
return afs_do_sync_operation(op);
13631364
}
@@ -1661,6 +1662,7 @@ static int afs_create(struct mnt_idmap *idmap, struct inode *dir,
16611662
op->dentry = dentry;
16621663
op->create.mode = S_IFREG | mode;
16631664
op->create.reason = afs_edit_dir_for_create;
1665+
op->mtime = current_time(dir);
16641666
op->ops = &afs_create_operation;
16651667
return afs_do_sync_operation(op);
16661668

@@ -1796,6 +1798,7 @@ static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir,
17961798
op->ops = &afs_symlink_operation;
17971799
op->create.reason = afs_edit_dir_for_symlink;
17981800
op->create.symlink = content;
1801+
op->mtime = current_time(dir);
17991802
return afs_do_sync_operation(op);
18001803

18011804
error:

0 commit comments

Comments
 (0)