Enabled use of fuse cacheing in lowntfs-3g under conditions

PERMISSION_HANDLING_BRANCH
Jean-Pierre André 2010-10-26 08:59:51 +02:00
parent e1ef554dd2
commit 9c0e3a7b4e
2 changed files with 37 additions and 8 deletions

View File

@ -58,7 +58,8 @@ enum {
*
* Stick to the recommended values unless you understand the consequences
* on protection and performances. Use of cacheing is good for
* performances, but bad on security.
* performances, but bad on security with internal fuse or external
* fuse older than 2.8
*
* Possible values for high level :
* 1 : no cache, kernel control (recommended)
@ -67,7 +68,7 @@ enum {
*
* Possible values for low level :
* 2 : no cache, kernel control
* 3 : use kernel/fuse cache, kernel control
* 3 : use kernel/fuse cache, kernel control (external fuse >= 2.8)
* 5 : no cache, file system control (recommended)
* 8 : no cache, kernel control for ACLs
*
@ -77,6 +78,10 @@ enum {
*/
#define HPERMSCONFIG 1
#if defined(FUSE_INTERNAL) || !defined(FUSE_VERSION) || (FUSE_VERSION < 28)
#define LPERMSCONFIG 5
#else
#define LPERMSCONFIG 3
#endif
#endif /* defined _NTFS_PARAM_H */

View File

@ -122,18 +122,17 @@
#endif
#if CACHEING & (KERNELACLS | !KERNELPERMS)
#warning "Fuse cacheing is broken unless basic permissions checked by kernel"
#warning "Fuse cacheing is only usable with basic permissions checked by kernel"
#endif
#if !CACHEING
/*
* FUSE cacheing is broken except for basic permissions
* checked by the kernel
* So do not use cacheing until this is fixed
*/
#define ATTR_TIMEOUT 0.0
#define ENTRY_TIMEOUT 0.0
#else
/*
* FUSE cacheing is only usable with basic permissions
* checked by the kernel with external fuse >= 2.8
*/
#define ATTR_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0)
#define ENTRY_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0)
#endif
@ -3028,6 +3027,18 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
set_fuse_error(&res);
} else
res = -errno;
#endif
#if CACHEING && !defined(FUSE_INTERNAL)
/*
* Most of system xattr settings cause changes to some
* file attribute (st_mode, st_nlink, st_mtime, etc.),
* so we must invalidate cached data when cacheing is
* in use (not possible with internal fuse or external
* fuse before 2.8)
*/
if ((res >= 0)
&& fuse_lowlevel_notify_inval_inode(ctx->fc, ino, -1, 0))
res = -errno;
#endif
if (res < 0)
fuse_reply_err(req, -res);
@ -3231,6 +3242,19 @@ static void ntfs_fuse_removexattr(fuse_req_t req, fuse_ino_t ino, const char *na
set_fuse_error(&res);
} else
res = -errno;
#endif
#if CACHEING && !defined(FUSE_INTERNAL)
/*
* Some allowed system xattr removals cause changes to
* some file attribute (st_mode, st_nlink, etc.),
* so we must invalidate cached data when cacheing is
* in use (not possible with internal fuse or external
* fuse before 2.8)
*/
if ((res >= 0)
&& fuse_lowlevel_notify_inval_inode(ctx->fc,
ino, -1, 0))
res = -errno;
#endif
break;
}