summaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMaxim Patlasov <MPatlasov@parallels.com>2014-04-28 14:19:24 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2014-04-28 14:19:24 +0200
commitab9e13f7c771b511d8f71666e83cb27bcc635b98 (patch)
treebc213ba010921446b018d89a72c317a6eb51c32f /fs/fuse
parente27c9d3877a0d0479711a55f5cdd7ee91442da53 (diff)
downloadlinux-ab9e13f7c771b511d8f71666e83cb27bcc635b98.tar.gz
linux-ab9e13f7c771b511d8f71666e83cb27bcc635b98.tar.bz2
linux-ab9e13f7c771b511d8f71666e83cb27bcc635b98.zip
fuse: allow ctime flushing to userspace
The patch extends fuse_setattr_in, and extends the flush procedure (fuse_flush_times()) called on ->write_inode() to send the ctime as well as mtime. Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dir.c9
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/fuse/fuse_i.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 8c233834591f..e6ba579e2937 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1597,7 +1597,7 @@ static void fuse_setattr_fill(struct fuse_conn *fc, struct fuse_req *req,
/*
* Flush inode->i_mtime to the server
*/
-int fuse_flush_mtime(struct inode *inode, struct fuse_file *ff)
+int fuse_flush_times(struct inode *inode, struct fuse_file *ff)
{
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_req *req;
@@ -1612,9 +1612,14 @@ int fuse_flush_mtime(struct inode *inode, struct fuse_file *ff)
memset(&inarg, 0, sizeof(inarg));
memset(&outarg, 0, sizeof(outarg));
- inarg.valid |= FATTR_MTIME;
+ inarg.valid = FATTR_MTIME;
inarg.mtime = inode->i_mtime.tv_sec;
inarg.mtimensec = inode->i_mtime.tv_nsec;
+ if (fc->minor >= 23) {
+ inarg.valid |= FATTR_CTIME;
+ inarg.ctime = inode->i_ctime.tv_sec;
+ inarg.ctimensec = inode->i_ctime.tv_nsec;
+ }
if (ff) {
inarg.valid |= FATTR_FH;
inarg.fh = ff->fh;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index d228c3962ffd..96d513e01a5d 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1691,7 +1691,7 @@ int fuse_write_inode(struct inode *inode, struct writeback_control *wbc)
int err;
ff = __fuse_write_file_get(fc, fi);
- err = fuse_flush_mtime(inode, ff);
+ err = fuse_flush_times(inode, ff);
if (ff)
fuse_file_put(ff, 0);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index d2f10054b9a1..40677e33504f 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -889,7 +889,7 @@ int fuse_dev_release(struct inode *inode, struct file *file);
bool fuse_write_update_size(struct inode *inode, loff_t pos);
-int fuse_flush_mtime(struct inode *inode, struct fuse_file *ff);
+int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);
int fuse_do_setattr(struct inode *inode, struct iattr *attr,