ino_invalidate_cb(NULL),
dentry_invalidate_cb(NULL),
getgroups_cb(NULL),
+ umask_cb(NULL),
can_invalidate_dentries(false),
require_remount(false),
async_ino_invalidator(m->cct),
remount_finisher.start();
}
getgroups_cb = args->getgroups_cb;
+ umask_cb = args->umask_cb;
}
int Client::test_dentry_handling(bool can_invalidate)
if (r > 0)
::encode(xattrs, xattrs_bl);
} else {
+ if (umask_cb)
+ *mode &= ~umask_cb(callback_handle);
r = 0;
}
}
typedef int (*client_getgroups_callback_t)(void *handle, gid_t **sgids);
typedef void(*client_switch_interrupt_callback_t)(void *handle, void *data);
+typedef mode_t (*client_umask_callback_t)(void *handle);
struct client_callback_args {
void *handle;
client_switch_interrupt_callback_t switch_intr_cb;
client_remount_callback_t remount_cb;
client_getgroups_callback_t getgroups_cb;
+ client_umask_callback_t umask_cb;
};
// ========================================================
client_ino_callback_t ino_invalidate_cb;
client_dentry_callback_t dentry_invalidate_cb;
client_getgroups_callback_t getgroups_cb;
+ client_umask_callback_t umask_cb;
bool can_invalidate_dentries;
bool require_remount;
int ll_flock(Fh *fh, int cmd, uint64_t owner);
int ll_file_layout(Fh *fh, ceph_file_layout *layout);
void ll_interrupt(void *d);
+ bool ll_handle_umask() {
+ return acl_type != NO_ACL;
+ }
+
int ll_get_stripe_osd(struct Inode *in, uint64_t blockno,
ceph_file_layout* layout);
uint64_t ll_get_internal_offset(struct Inode *in, uint64_t blockno);
#endif
}
+static mode_t umask_cb(void *handle)
+{
+ CephFuse::Handle *cfuse = (CephFuse::Handle *)handle;
+ fuse_req_t req = cfuse->get_fuse_req();
+ const struct fuse_ctx *ctx = fuse_req_ctx(req);
+ return ctx->umask;
+}
+
static void ino_invalidate_cb(void *handle, vinodeno_t vino, int64_t off,
int64_t len)
{
return r;
}
-static void do_init(void *data, fuse_conn_info *bar)
+static void do_init(void *data, fuse_conn_info *conn)
{
CephFuse::Handle *cfuse = (CephFuse::Handle *)data;
+ Client *client = cfuse->client;
+
+ if (!client->cct->_conf->fuse_default_permissions &&
+ client->ll_handle_umask()) {
+ // apply umask in userspace if posix acl is enabled
+ if(conn->capable & FUSE_CAP_DONT_MASK)
+ conn->want |= FUSE_CAP_DONT_MASK;
+ }
+
if (cfuse->fd_on_success) {
//cout << "fuse init signaling on fd " << fd_on_success << std::endl;
uint32_t r = 0;
remount_cb: remount_cb,
#endif
getgroups_cb: getgroups_cb,
+ umask_cb: umask_cb,
};
client->ll_register_callbacks(&args);