Commit ab9e13f7 authored by Maxim Patlasov's avatar Maxim Patlasov Committed by Miklos Szeredi

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: default avatarMaxim Patlasov <MPatlasov@parallels.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent e27c9d38
...@@ -1597,7 +1597,7 @@ static void fuse_setattr_fill(struct fuse_conn *fc, struct fuse_req *req, ...@@ -1597,7 +1597,7 @@ static void fuse_setattr_fill(struct fuse_conn *fc, struct fuse_req *req,
/* /*
* Flush inode->i_mtime to the server * 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_conn *fc = get_fuse_conn(inode);
struct fuse_req *req; struct fuse_req *req;
...@@ -1612,9 +1612,14 @@ int fuse_flush_mtime(struct inode *inode, struct fuse_file *ff) ...@@ -1612,9 +1612,14 @@ int fuse_flush_mtime(struct inode *inode, struct fuse_file *ff)
memset(&inarg, 0, sizeof(inarg)); memset(&inarg, 0, sizeof(inarg));
memset(&outarg, 0, sizeof(outarg)); memset(&outarg, 0, sizeof(outarg));
inarg.valid |= FATTR_MTIME; inarg.valid = FATTR_MTIME;
inarg.mtime = inode->i_mtime.tv_sec; inarg.mtime = inode->i_mtime.tv_sec;
inarg.mtimensec = inode->i_mtime.tv_nsec; 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) { if (ff) {
inarg.valid |= FATTR_FH; inarg.valid |= FATTR_FH;
inarg.fh = ff->fh; inarg.fh = ff->fh;
......
...@@ -1691,7 +1691,7 @@ int fuse_write_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -1691,7 +1691,7 @@ int fuse_write_inode(struct inode *inode, struct writeback_control *wbc)
int err; int err;
ff = __fuse_write_file_get(fc, fi); ff = __fuse_write_file_get(fc, fi);
err = fuse_flush_mtime(inode, ff); err = fuse_flush_times(inode, ff);
if (ff) if (ff)
fuse_file_put(ff, 0); fuse_file_put(ff, 0);
......
...@@ -889,7 +889,7 @@ int fuse_dev_release(struct inode *inode, struct file *file); ...@@ -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); 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_write_inode(struct inode *inode, struct writeback_control *wbc);
int fuse_do_setattr(struct inode *inode, struct iattr *attr, int fuse_do_setattr(struct inode *inode, struct iattr *attr,
......
...@@ -98,6 +98,8 @@ ...@@ -98,6 +98,8 @@
* - add FUSE_WRITEBACK_CACHE * - add FUSE_WRITEBACK_CACHE
* - add time_gran to fuse_init_out * - add time_gran to fuse_init_out
* - add reserved space to fuse_init_out * - add reserved space to fuse_init_out
* - add FATTR_CTIME
* - add ctime and ctimensec to fuse_setattr_in
*/ */
#ifndef _LINUX_FUSE_H #ifndef _LINUX_FUSE_H
...@@ -193,6 +195,7 @@ struct fuse_file_lock { ...@@ -193,6 +195,7 @@ struct fuse_file_lock {
#define FATTR_ATIME_NOW (1 << 7) #define FATTR_ATIME_NOW (1 << 7)
#define FATTR_MTIME_NOW (1 << 8) #define FATTR_MTIME_NOW (1 << 8)
#define FATTR_LOCKOWNER (1 << 9) #define FATTR_LOCKOWNER (1 << 9)
#define FATTR_CTIME (1 << 10)
/** /**
* Flags returned by the OPEN request * Flags returned by the OPEN request
...@@ -440,10 +443,10 @@ struct fuse_setattr_in { ...@@ -440,10 +443,10 @@ struct fuse_setattr_in {
uint64_t lock_owner; uint64_t lock_owner;
uint64_t atime; uint64_t atime;
uint64_t mtime; uint64_t mtime;
uint64_t unused2; uint64_t ctime;
uint32_t atimensec; uint32_t atimensec;
uint32_t mtimensec; uint32_t mtimensec;
uint32_t unused3; uint32_t ctimensec;
uint32_t mode; uint32_t mode;
uint32_t unused4; uint32_t unused4;
uint32_t uid; uint32_t uid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment