mirror of https://gitee.com/openkylin/linux.git
Mostly cleanups, but three bug fixes:
1. don't pass garbage return codes back up the call chain (Mike Marshall) 2. fix stale inode test (Martin Brandenburg) 3. fix off-by-one errors (Xiongfeng Wang) Also: add Martin as a reviewer in the Maintainers file. -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJaejneAAoJEM9EDqnrzg2+XhoQAIDF112mOwLwqDPmr4ty0g6/ gBcoHOrRFlYWPlS5aubjoZ3jFX2fAeNuHzYS4LIuqVKUdsC+oTKQ2URJ7KKpvLiK 6zOaz2Y4GLns2sa1ZUKli6nEBbPi6uwoF54FNbwt3b+97wpmJwlnXm9ztyt5REKA zOHvLgJAcfGNZEJ7gyB1zjwllu4JeD0A4MoN4vJCtkKLAaNClywu4+V0jwZB+SSN 8QjDXNqkcD31ahWhQ/CaU4zXlxOOV+4ZR7/p5IKT693hEhV+ikTvmXy8g0+bksxj L+FHmQMTO+GqCS5FxuBQd3v1IP5FkoHEmAwvr3C5aMlRAaVJ9eVVIZaC9CpOJBRB S/CiaG2Mw8vx8VGOm8O93Z+xDi9tCYP8x4i7b5r62h0T9wSyHJSkSIUd6VIkCV9Q c92bX/N3wHBvCPT+RC898plni5HsFpzs3vSs8hiaAICgp64sC8pIqVlZOAdMtJd8 RL4la/Fited/T+3BpaCTkmnvNk8Ktax7wHYsCt4gSyHN8WRvkzowgC5kV6S30Qlh zfoXG0K50FcU8T5r3i8slvUHmsiyYxYwJIk/z1iDgXI7y4IIR6FGDxQmw5TxgNS7 +veTo6FCxon6QshtpAOeELCau7qNXhtlDdGqqm4+gDfMWoCn0Jem/LzdA2gPXCOr iCDwHLiu6WXt7ZHTrgln =xrih -----END PGP SIGNATURE----- Merge tag 'for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux Pull orangefs updates from Mike Marshall: "Mostly cleanups, but three bug fixes: - don't pass garbage return codes back up the call chain (Mike Marshall) - fix stale inode test (Martin Brandenburg) - fix off-by-one errors (Xiongfeng Wang) Also add Martin as a reviewer in the Maintainers file" * tag 'for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux: orangefs: reverse sense of is-inode-stale test in d_revalidate orangefs: simplify orangefs_inode_is_stale Orangefs: don't propogate whacky error codes orangefs: use correct string length orangefs: make orangefs_make_bad_inode static orangefs: remove ORANGEFS_KERNEL_DEBUG orangefs: remove gossip_ldebug and gossip_lerr orangefs: make orangefs_client_debug_init static MAINTAINERS: update orangefs list and add myself as reviewer
This commit is contained in:
commit
a0f79386a4
|
@ -10331,7 +10331,8 @@ F: fs/ocfs2/
|
|||
|
||||
ORANGEFS FILESYSTEM
|
||||
M: Mike Marshall <hubcap@omnibond.com>
|
||||
L: pvfs2-developers@beowulf-underground.org (subscribers-only)
|
||||
R: Martin Brandenburg <martin@omnibond.com>
|
||||
L: devel@lists.orangefs.org
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux.git
|
||||
S: Supported
|
||||
F: fs/orangefs/
|
||||
|
|
|
@ -33,7 +33,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
|
|||
new_op->upcall.req.lookup.parent_refn = parent->refn;
|
||||
strncpy(new_op->upcall.req.lookup.d_name,
|
||||
dentry->d_name.name,
|
||||
ORANGEFS_NAME_MAX);
|
||||
ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
gossip_debug(GOSSIP_DCACHE_DEBUG,
|
||||
"%s:%s:%d interrupt flag [%d]\n",
|
||||
|
@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
|
|||
return 0;
|
||||
|
||||
/* We do not need to continue with negative dentries. */
|
||||
if (!dentry->d_inode)
|
||||
goto out;
|
||||
if (!dentry->d_inode) {
|
||||
gossip_debug(GOSSIP_DCACHE_DEBUG,
|
||||
"%s: negative dentry or positive dentry and inode valid.\n",
|
||||
__func__);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Now we must perform a getattr to validate the inode contents. */
|
||||
|
||||
|
@ -129,14 +133,7 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
|
|||
__FILE__, __func__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
if (ret == 0)
|
||||
return 0;
|
||||
|
||||
out:
|
||||
gossip_debug(GOSSIP_DCACHE_DEBUG,
|
||||
"%s: negative dentry or positive dentry and inode valid.\n",
|
||||
__func__);
|
||||
return 1;
|
||||
return !ret;
|
||||
}
|
||||
|
||||
const struct dentry_operations orangefs_dentry_operations = {
|
||||
|
|
|
@ -41,7 +41,7 @@ static int orangefs_create(struct inode *dir,
|
|||
ORANGEFS_TYPE_METAFILE, mode);
|
||||
|
||||
strncpy(new_op->upcall.req.create.d_name,
|
||||
dentry->d_name.name, ORANGEFS_NAME_MAX);
|
||||
dentry->d_name.name, ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
|
||||
|
||||
|
@ -142,7 +142,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
|
|||
new_op->upcall.req.lookup.parent_refn = parent->refn;
|
||||
|
||||
strncpy(new_op->upcall.req.lookup.d_name, dentry->d_name.name,
|
||||
ORANGEFS_NAME_MAX);
|
||||
ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
gossip_debug(GOSSIP_NAME_DEBUG,
|
||||
"%s: doing lookup on %s under %pU,%d\n",
|
||||
|
@ -244,7 +244,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
|
|||
|
||||
new_op->upcall.req.remove.parent_refn = parent->refn;
|
||||
strncpy(new_op->upcall.req.remove.d_name, dentry->d_name.name,
|
||||
ORANGEFS_NAME_MAX);
|
||||
ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
ret = service_operation(new_op, "orangefs_unlink",
|
||||
get_interruptible_flag(inode));
|
||||
|
@ -300,8 +300,8 @@ static int orangefs_symlink(struct inode *dir,
|
|||
|
||||
strncpy(new_op->upcall.req.sym.entry_name,
|
||||
dentry->d_name.name,
|
||||
ORANGEFS_NAME_MAX);
|
||||
strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX);
|
||||
ORANGEFS_NAME_MAX - 1);
|
||||
strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
|
||||
|
||||
|
@ -372,7 +372,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
|
|||
ORANGEFS_TYPE_DIRECTORY, mode);
|
||||
|
||||
strncpy(new_op->upcall.req.mkdir.d_name,
|
||||
dentry->d_name.name, ORANGEFS_NAME_MAX);
|
||||
dentry->d_name.name, ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
|
||||
|
||||
|
@ -453,10 +453,10 @@ static int orangefs_rename(struct inode *old_dir,
|
|||
|
||||
strncpy(new_op->upcall.req.rename.d_old_name,
|
||||
old_dentry->d_name.name,
|
||||
ORANGEFS_NAME_MAX);
|
||||
ORANGEFS_NAME_MAX - 1);
|
||||
strncpy(new_op->upcall.req.rename.d_new_name,
|
||||
new_dentry->d_name.name,
|
||||
ORANGEFS_NAME_MAX);
|
||||
ORANGEFS_NAME_MAX - 1);
|
||||
|
||||
ret = service_operation(new_op,
|
||||
"orangefs_rename",
|
||||
|
|
|
@ -328,7 +328,7 @@ static int help_show(struct seq_file *m, void *v)
|
|||
/*
|
||||
* initialize the client-debug file.
|
||||
*/
|
||||
int orangefs_client_debug_init(void)
|
||||
static int orangefs_client_debug_init(void)
|
||||
{
|
||||
|
||||
int rc = -ENOMEM;
|
||||
|
@ -1056,7 +1056,7 @@ int orangefs_debugfs_new_debug(void __user *arg)
|
|||
client_debug_string,
|
||||
llu(mask_info.mask_value));
|
||||
} else {
|
||||
gossip_lerr("Invalid mask type....\n");
|
||||
gossip_err("Invalid mask type....\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
int orangefs_debugfs_init(int);
|
||||
void orangefs_debugfs_cleanup(void);
|
||||
int orangefs_client_debug_init(void);
|
||||
int orangefs_prepare_debugfs_help_string(int);
|
||||
int orangefs_debugfs_new_client_mask(void __user *);
|
||||
int orangefs_debugfs_new_client_string(void __user *);
|
||||
|
|
|
@ -56,11 +56,7 @@
|
|||
|
||||
#include "orangefs-dev-proto.h"
|
||||
|
||||
#ifdef ORANGEFS_KERNEL_DEBUG
|
||||
#define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 10
|
||||
#else
|
||||
#define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 20
|
||||
#endif
|
||||
|
||||
#define ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS 30
|
||||
|
||||
|
@ -104,11 +100,11 @@ enum orangefs_vfs_op_states {
|
|||
* orangefs kernel memory related flags
|
||||
*/
|
||||
|
||||
#if ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB))
|
||||
#if (defined CONFIG_DEBUG_SLAB)
|
||||
#define ORANGEFS_CACHE_CREATE_FLAGS SLAB_RED_ZONE
|
||||
#else
|
||||
#define ORANGEFS_CACHE_CREATE_FLAGS 0
|
||||
#endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */
|
||||
#endif
|
||||
|
||||
extern int orangefs_init_acl(struct inode *inode, struct inode *dir);
|
||||
extern const struct xattr_handler *orangefs_xattr_handlers[];
|
||||
|
@ -471,8 +467,6 @@ int orangefs_inode_check_changed(struct inode *inode);
|
|||
|
||||
int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
|
||||
|
||||
void orangefs_make_bad_inode(struct inode *inode);
|
||||
|
||||
int orangefs_unmount_sb(struct super_block *sb);
|
||||
|
||||
bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
|
||||
|
|
|
@ -230,25 +230,42 @@ static int orangefs_inode_type(enum orangefs_ds_type objtype)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int orangefs_inode_is_stale(struct inode *inode, int new,
|
||||
static void orangefs_make_bad_inode(struct inode *inode)
|
||||
{
|
||||
if (is_root_handle(inode)) {
|
||||
/*
|
||||
* if this occurs, the pvfs2-client-core was killed but we
|
||||
* can't afford to lose the inode operations and such
|
||||
* associated with the root handle in any case.
|
||||
*/
|
||||
gossip_debug(GOSSIP_UTILS_DEBUG,
|
||||
"*** NOT making bad root inode %pU\n",
|
||||
get_khandle_from_ino(inode));
|
||||
} else {
|
||||
gossip_debug(GOSSIP_UTILS_DEBUG,
|
||||
"*** making bad inode %pU\n",
|
||||
get_khandle_from_ino(inode));
|
||||
make_bad_inode(inode);
|
||||
}
|
||||
}
|
||||
|
||||
static int orangefs_inode_is_stale(struct inode *inode,
|
||||
struct ORANGEFS_sys_attr_s *attrs, char *link_target)
|
||||
{
|
||||
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
|
||||
int type = orangefs_inode_type(attrs->objtype);
|
||||
if (!new) {
|
||||
/*
|
||||
* If the inode type or symlink target have changed then this
|
||||
* inode is stale.
|
||||
*/
|
||||
if (type == -1 || !(inode->i_mode & type)) {
|
||||
orangefs_make_bad_inode(inode);
|
||||
return 1;
|
||||
}
|
||||
if (type == S_IFLNK && strncmp(orangefs_inode->link_target,
|
||||
link_target, ORANGEFS_NAME_MAX)) {
|
||||
orangefs_make_bad_inode(inode);
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* If the inode type or symlink target have changed then this
|
||||
* inode is stale.
|
||||
*/
|
||||
if (type == -1 || !(inode->i_mode & type)) {
|
||||
orangefs_make_bad_inode(inode);
|
||||
return 1;
|
||||
}
|
||||
if (type == S_IFLNK && strncmp(orangefs_inode->link_target,
|
||||
link_target, ORANGEFS_NAME_MAX)) {
|
||||
orangefs_make_bad_inode(inode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -294,16 +311,18 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
|
|||
if (ret != 0)
|
||||
goto out;
|
||||
|
||||
type = orangefs_inode_type(new_op->
|
||||
downcall.resp.getattr.attributes.objtype);
|
||||
ret = orangefs_inode_is_stale(inode, new,
|
||||
&new_op->downcall.resp.getattr.attributes,
|
||||
new_op->downcall.resp.getattr.link_target);
|
||||
if (ret) {
|
||||
ret = -ESTALE;
|
||||
goto out;
|
||||
if (!new) {
|
||||
ret = orangefs_inode_is_stale(inode,
|
||||
&new_op->downcall.resp.getattr.attributes,
|
||||
new_op->downcall.resp.getattr.link_target);
|
||||
if (ret) {
|
||||
ret = -ESTALE;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
type = orangefs_inode_type(new_op->
|
||||
downcall.resp.getattr.attributes.objtype);
|
||||
switch (type) {
|
||||
case S_IFREG:
|
||||
inode->i_flags = orangefs_inode_flags(&new_op->
|
||||
|
@ -348,6 +367,12 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
|
|||
inode->i_link = orangefs_inode->link_target;
|
||||
}
|
||||
break;
|
||||
/* i.e. -1 */
|
||||
default:
|
||||
/* XXX: ESTALE? This is what is done if it is not new. */
|
||||
orangefs_make_bad_inode(inode);
|
||||
ret = -ESTALE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
inode->i_uid = make_kuid(&init_user_ns, new_op->
|
||||
|
@ -401,7 +426,7 @@ int orangefs_inode_check_changed(struct inode *inode)
|
|||
if (ret != 0)
|
||||
goto out;
|
||||
|
||||
ret = orangefs_inode_is_stale(inode, 0,
|
||||
ret = orangefs_inode_is_stale(inode,
|
||||
&new_op->downcall.resp.getattr.attributes,
|
||||
new_op->downcall.resp.getattr.link_target);
|
||||
out:
|
||||
|
@ -444,25 +469,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void orangefs_make_bad_inode(struct inode *inode)
|
||||
{
|
||||
if (is_root_handle(inode)) {
|
||||
/*
|
||||
* if this occurs, the pvfs2-client-core was killed but we
|
||||
* can't afford to lose the inode operations and such
|
||||
* associated with the root handle in any case.
|
||||
*/
|
||||
gossip_debug(GOSSIP_UTILS_DEBUG,
|
||||
"*** NOT making bad root inode %pU\n",
|
||||
get_khandle_from_ino(inode));
|
||||
} else {
|
||||
gossip_debug(GOSSIP_UTILS_DEBUG,
|
||||
"*** making bad inode %pU\n",
|
||||
get_khandle_from_ino(inode));
|
||||
make_bad_inode(inode);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The following is a very dirty hack that is now a permanent part of the
|
||||
* ORANGEFS protocol. See protocol.h for more error definitions.
|
||||
|
@ -537,6 +543,7 @@ int orangefs_normalize_to_errno(__s32 error_code)
|
|||
*/
|
||||
} else {
|
||||
gossip_err("orangefs: orangefs_normalize_to_errno: got error code which is not from ORANGEFS.\n");
|
||||
error_code = -EINVAL;
|
||||
}
|
||||
return error_code;
|
||||
}
|
||||
|
|
|
@ -395,13 +395,6 @@ struct ORANGEFS_dev_map_desc {
|
|||
|
||||
/* gossip.h *****************************************************************/
|
||||
|
||||
#ifdef GOSSIP_DISABLE_DEBUG
|
||||
#define gossip_debug(mask, fmt, ...) \
|
||||
do { \
|
||||
if (0) \
|
||||
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
extern __u64 orangefs_gossip_debug_mask;
|
||||
|
||||
/* try to avoid function call overhead by checking masks in macro */
|
||||
|
@ -410,13 +403,5 @@ do { \
|
|||
if (orangefs_gossip_debug_mask & (mask)) \
|
||||
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif /* GOSSIP_DISABLE_DEBUG */
|
||||
|
||||
/* do file and line number printouts w/ the GNU preprocessor */
|
||||
#define gossip_ldebug(mask, fmt, ...) \
|
||||
gossip_debug(mask, "%s: " fmt, __func__, ##__VA_ARGS__)
|
||||
|
||||
#define gossip_err pr_err
|
||||
#define gossip_lerr(fmt, ...) \
|
||||
gossip_err("%s line %d: " fmt, \
|
||||
__FILE__, __LINE__, ##__VA_ARGS__)
|
||||
|
|
|
@ -335,7 +335,7 @@ static int orangefs_encode_fh(struct inode *inode,
|
|||
struct orangefs_object_kref refn;
|
||||
|
||||
if (*max_len < len) {
|
||||
gossip_lerr("fh buffer is too small for encoding\n");
|
||||
gossip_err("fh buffer is too small for encoding\n");
|
||||
*max_len = len;
|
||||
type = 255;
|
||||
goto out;
|
||||
|
@ -383,7 +383,7 @@ static int orangefs_unmount(int id, __s32 fs_id, const char *devname)
|
|||
op->upcall.req.fs_umount.id = id;
|
||||
op->upcall.req.fs_umount.fs_id = fs_id;
|
||||
strncpy(op->upcall.req.fs_umount.orangefs_config_server,
|
||||
devname, ORANGEFS_MAX_SERVER_ADDR_LEN);
|
||||
devname, ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
|
||||
r = service_operation(op, "orangefs_fs_umount", 0);
|
||||
/* Not much to do about an error here. */
|
||||
if (r)
|
||||
|
@ -478,7 +478,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
|
|||
|
||||
strncpy(new_op->upcall.req.fs_mount.orangefs_config_server,
|
||||
devname,
|
||||
ORANGEFS_MAX_SERVER_ADDR_LEN);
|
||||
ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
|
||||
|
||||
gossip_debug(GOSSIP_SUPER_DEBUG,
|
||||
"Attempting ORANGEFS Mount via host %s\n",
|
||||
|
@ -520,7 +520,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
|
|||
*/
|
||||
strncpy(ORANGEFS_SB(sb)->devname,
|
||||
devname,
|
||||
ORANGEFS_MAX_SERVER_ADDR_LEN);
|
||||
ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
|
||||
|
||||
/* mount_pending must be cleared */
|
||||
ORANGEFS_SB(sb)->mount_pending = 0;
|
||||
|
|
Loading…
Reference in New Issue