diff options
| author | Ravishankar N <ravishankar@redhat.com> | 2015-07-01 08:28:07 +0530 | 
|---|---|---|
| committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2016-02-06 21:56:46 -0800 | 
| commit | ff12c4a83bb897501f6e10c1bfe3a69f3dc6cdb9 (patch) | |
| tree | dfb72ae9191a62192c41b86a6aafe91826b29109 | |
| parent | c7d2037b8c6293663280a759a2e447d5aef130bd (diff) | |
fuse: update fuse_kernel.h to version 23
The following changes were made upstream:
 - add FUSE_WRITEBACK_CACHE
 - add time_gran to fuse_init_out
 - add reserved space to fuse_init_out
 - add FATTR_CTIME
 - add ctime and ctimensec to fuse_setattr_in
 - add FUSE_RENAME2 request
 - add FUSE_NO_OPEN_SUPPORT flag
Including these changes will make it easier to backport support for
lseek().
Because the fuse_init_out structure changed its size, older versions of
FUSE would fail initializing. When an older version of FUSE is detected,
the fuse_init_out structure is reduced to the previous size. This is
harmless, as the attributes that are not passed, are not used for
earlier versions anyway.
BUG: 1220173
Change-Id: I58c74e161638b2d4ce12fc91a206fdc1b96de14d
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
[ndevos: splitted from http://review.gluster.org/11474
         old version fuse_init_out size correction]
Reviewed-on: http://review.gluster.org/11537
Smoke: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
| -rw-r--r-- | contrib/fuse-include/fuse_kernel.h | 32 | ||||
| -rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 11 | 
2 files changed, 39 insertions, 4 deletions
diff --git a/contrib/fuse-include/fuse_kernel.h b/contrib/fuse-include/fuse_kernel.h index 60bb2f9f7b7..25084a052a1 100644 --- a/contrib/fuse-include/fuse_kernel.h +++ b/contrib/fuse-include/fuse_kernel.h @@ -93,6 +93,15 @@   *   * 7.22   *  - add FUSE_ASYNC_DIO + * + * 7.23 + *  - add FUSE_WRITEBACK_CACHE + *  - add time_gran to fuse_init_out + *  - add reserved space to fuse_init_out + *  - add FATTR_CTIME + *  - add ctime and ctimensec to fuse_setattr_in + *  - add FUSE_RENAME2 request + *  - add FUSE_NO_OPEN_SUPPORT flag   */  #ifndef _LINUX_FUSE_H @@ -128,7 +137,7 @@  #define FUSE_KERNEL_VERSION 7  /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 22 +#define FUSE_KERNEL_MINOR_VERSION 23  /** The node ID of the root inode */  #define FUSE_ROOT_ID 1 @@ -188,6 +197,7 @@ struct fuse_file_lock {  #define FATTR_ATIME_NOW	(1 << 7)  #define FATTR_MTIME_NOW	(1 << 8)  #define FATTR_LOCKOWNER	(1 << 9) +#define FATTR_CTIME	(1 << 10)  /**   * Flags returned by the OPEN request @@ -219,6 +229,8 @@ struct fuse_file_lock {   * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)   * FUSE_READDIRPLUS_AUTO: adaptive readdirplus   * FUSE_ASYNC_DIO: asynchronous direct I/O submission + * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes + * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens   */  #define FUSE_ASYNC_READ		(1 << 0)  #define FUSE_POSIX_LOCKS	(1 << 1) @@ -236,6 +248,8 @@ struct fuse_file_lock {  #define FUSE_DO_READDIRPLUS	(1 << 13)  #define FUSE_READDIRPLUS_AUTO	(1 << 14)  #define FUSE_ASYNC_DIO		(1 << 15) +#define FUSE_WRITEBACK_CACHE	(1 << 16) +#define FUSE_NO_OPEN_SUPPORT	(1 << 17)  /**   * CUSE INIT request/reply flags @@ -343,6 +357,7 @@ enum fuse_opcode {  	FUSE_BATCH_FORGET  = 42,  	FUSE_FALLOCATE     = 43,  	FUSE_READDIRPLUS   = 44, +	FUSE_RENAME2       = 45,  	/* CUSE specific operations */  	CUSE_INIT          = 4096, @@ -421,6 +436,12 @@ struct fuse_rename_in {  	uint64_t	newdir;  }; +struct fuse_rename2_in { +	uint64_t	newdir; +	uint32_t	flags; +	uint32_t	padding; +}; +  struct fuse_link_in {  	uint64_t	oldnodeid;  }; @@ -433,10 +454,10 @@ struct fuse_setattr_in {  	uint64_t	lock_owner;  	uint64_t	atime;  	uint64_t	mtime; -	uint64_t	unused2; +	uint64_t	ctime;  	uint32_t	atimensec;  	uint32_t	mtimensec; -	uint32_t	unused3; +	uint32_t	ctimensec;  	uint32_t	mode;  	uint32_t	unused4;  	uint32_t	uid; @@ -554,6 +575,9 @@ struct fuse_init_in {  	uint32_t	flags;  }; +#define FUSE_COMPAT_INIT_OUT_SIZE 8 +#define FUSE_COMPAT_22_INIT_OUT_SIZE 24 +  struct fuse_init_out {  	uint32_t	major;  	uint32_t	minor; @@ -562,6 +586,8 @@ struct fuse_init_out {  	uint16_t	max_background;  	uint16_t	congestion_threshold;  	uint32_t	max_write; +	uint32_t	time_gran; +	uint32_t	unused[9];  };  #define CUSE_INIT_INFO_MAX 4096 diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index dd8ac1b1c74..dabef3598cc 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3923,6 +3923,7 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)          struct fuse_init_in  *fini      = msg;          struct fuse_init_out  fino      = {0,};          fuse_private_t       *priv      = NULL; +        size_t                size      = 0;          int                   ret       = 0;  #if FUSE_KERNEL_MINOR_VERSION >= 9          pthread_t             messenger; @@ -4060,7 +4061,15 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)  	if (fini->flags & FUSE_ASYNC_DIO)  		fino.flags |= FUSE_ASYNC_DIO;  #endif -        ret = send_fuse_obj (this, finh, &fino); +        /* FUSE 7.23 and newer added attributes to the fuse_init_out struct */ +        if (fini->minor > 22) { +                size = sizeof (fino); +        } else { +                /* reduce the size, chop off unused attributes from &fino */ +                size = FUSE_COMPAT_22_INIT_OUT_SIZE; +        } + +        ret = send_fuse_data (this, finh, &fino, size);          if (ret == 0)                  gf_log ("glusterfs-fuse", GF_LOG_INFO,                          "FUSE inited with protocol versions:"  | 
