Commit a0f79386 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 81153336 74e938c2
...@@ -10331,7 +10331,8 @@ F: fs/ocfs2/ ...@@ -10331,7 +10331,8 @@ F: fs/ocfs2/
ORANGEFS FILESYSTEM ORANGEFS FILESYSTEM
M: Mike Marshall <hubcap@omnibond.com> 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 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux.git
S: Supported S: Supported
F: fs/orangefs/ F: fs/orangefs/
......
...@@ -33,7 +33,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry) ...@@ -33,7 +33,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
new_op->upcall.req.lookup.parent_refn = parent->refn; new_op->upcall.req.lookup.parent_refn = parent->refn;
strncpy(new_op->upcall.req.lookup.d_name, strncpy(new_op->upcall.req.lookup.d_name,
dentry->d_name.name, dentry->d_name.name,
ORANGEFS_NAME_MAX); ORANGEFS_NAME_MAX - 1);
gossip_debug(GOSSIP_DCACHE_DEBUG, gossip_debug(GOSSIP_DCACHE_DEBUG,
"%s:%s:%d interrupt flag [%d]\n", "%s:%s:%d interrupt flag [%d]\n",
...@@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
return 0; return 0;
/* We do not need to continue with negative dentries. */ /* We do not need to continue with negative dentries. */
if (!dentry->d_inode) if (!dentry->d_inode) {
goto out; 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. */ /* 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) ...@@ -129,14 +133,7 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
__FILE__, __func__, __LINE__); __FILE__, __func__, __LINE__);
return 0; return 0;
} }
if (ret == 0) return !ret;
return 0;
out:
gossip_debug(GOSSIP_DCACHE_DEBUG,
"%s: negative dentry or positive dentry and inode valid.\n",
__func__);
return 1;
} }
const struct dentry_operations orangefs_dentry_operations = { const struct dentry_operations orangefs_dentry_operations = {
......
...@@ -41,7 +41,7 @@ static int orangefs_create(struct inode *dir, ...@@ -41,7 +41,7 @@ static int orangefs_create(struct inode *dir,
ORANGEFS_TYPE_METAFILE, mode); ORANGEFS_TYPE_METAFILE, mode);
strncpy(new_op->upcall.req.create.d_name, 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)); 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, ...@@ -142,7 +142,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
new_op->upcall.req.lookup.parent_refn = parent->refn; new_op->upcall.req.lookup.parent_refn = parent->refn;
strncpy(new_op->upcall.req.lookup.d_name, dentry->d_name.name, strncpy(new_op->upcall.req.lookup.d_name, dentry->d_name.name,
ORANGEFS_NAME_MAX); ORANGEFS_NAME_MAX - 1);
gossip_debug(GOSSIP_NAME_DEBUG, gossip_debug(GOSSIP_NAME_DEBUG,
"%s: doing lookup on %s under %pU,%d\n", "%s: doing lookup on %s under %pU,%d\n",
...@@ -244,7 +244,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -244,7 +244,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
new_op->upcall.req.remove.parent_refn = parent->refn; new_op->upcall.req.remove.parent_refn = parent->refn;
strncpy(new_op->upcall.req.remove.d_name, dentry->d_name.name, 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", ret = service_operation(new_op, "orangefs_unlink",
get_interruptible_flag(inode)); get_interruptible_flag(inode));
...@@ -300,8 +300,8 @@ static int orangefs_symlink(struct inode *dir, ...@@ -300,8 +300,8 @@ static int orangefs_symlink(struct inode *dir,
strncpy(new_op->upcall.req.sym.entry_name, strncpy(new_op->upcall.req.sym.entry_name,
dentry->d_name.name, dentry->d_name.name,
ORANGEFS_NAME_MAX); ORANGEFS_NAME_MAX - 1);
strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX); strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX - 1);
ret = service_operation(new_op, __func__, get_interruptible_flag(dir)); 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 ...@@ -372,7 +372,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
ORANGEFS_TYPE_DIRECTORY, mode); ORANGEFS_TYPE_DIRECTORY, mode);
strncpy(new_op->upcall.req.mkdir.d_name, 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)); ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
...@@ -453,10 +453,10 @@ static int orangefs_rename(struct inode *old_dir, ...@@ -453,10 +453,10 @@ static int orangefs_rename(struct inode *old_dir,
strncpy(new_op->upcall.req.rename.d_old_name, strncpy(new_op->upcall.req.rename.d_old_name,
old_dentry->d_name.name, old_dentry->d_name.name,
ORANGEFS_NAME_MAX); ORANGEFS_NAME_MAX - 1);
strncpy(new_op->upcall.req.rename.d_new_name, strncpy(new_op->upcall.req.rename.d_new_name,
new_dentry->d_name.name, new_dentry->d_name.name,
ORANGEFS_NAME_MAX); ORANGEFS_NAME_MAX - 1);
ret = service_operation(new_op, ret = service_operation(new_op,
"orangefs_rename", "orangefs_rename",
......
...@@ -328,7 +328,7 @@ static int help_show(struct seq_file *m, void *v) ...@@ -328,7 +328,7 @@ static int help_show(struct seq_file *m, void *v)
/* /*
* initialize the client-debug file. * initialize the client-debug file.
*/ */
int orangefs_client_debug_init(void) static int orangefs_client_debug_init(void)
{ {
int rc = -ENOMEM; int rc = -ENOMEM;
...@@ -1056,7 +1056,7 @@ int orangefs_debugfs_new_debug(void __user *arg) ...@@ -1056,7 +1056,7 @@ int orangefs_debugfs_new_debug(void __user *arg)
client_debug_string, client_debug_string,
llu(mask_info.mask_value)); llu(mask_info.mask_value));
} else { } else {
gossip_lerr("Invalid mask type....\n"); gossip_err("Invalid mask type....\n");
return -EINVAL; return -EINVAL;
} }
......
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
int orangefs_debugfs_init(int); int orangefs_debugfs_init(int);
void orangefs_debugfs_cleanup(void); void orangefs_debugfs_cleanup(void);
int orangefs_client_debug_init(void);
int orangefs_prepare_debugfs_help_string(int); int orangefs_prepare_debugfs_help_string(int);
int orangefs_debugfs_new_client_mask(void __user *); int orangefs_debugfs_new_client_mask(void __user *);
int orangefs_debugfs_new_client_string(void __user *); int orangefs_debugfs_new_client_string(void __user *);
......
...@@ -56,11 +56,7 @@ ...@@ -56,11 +56,7 @@
#include "orangefs-dev-proto.h" #include "orangefs-dev-proto.h"
#ifdef ORANGEFS_KERNEL_DEBUG
#define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 10
#else
#define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 20 #define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 20
#endif
#define ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS 30 #define ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS 30
...@@ -104,11 +100,11 @@ enum orangefs_vfs_op_states { ...@@ -104,11 +100,11 @@ enum orangefs_vfs_op_states {
* orangefs kernel memory related flags * 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 #define ORANGEFS_CACHE_CREATE_FLAGS SLAB_RED_ZONE
#else #else
#define ORANGEFS_CACHE_CREATE_FLAGS 0 #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 int orangefs_init_acl(struct inode *inode, struct inode *dir);
extern const struct xattr_handler *orangefs_xattr_handlers[]; extern const struct xattr_handler *orangefs_xattr_handlers[];
...@@ -471,8 +467,6 @@ int orangefs_inode_check_changed(struct inode *inode); ...@@ -471,8 +467,6 @@ int orangefs_inode_check_changed(struct inode *inode);
int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr); 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); int orangefs_unmount_sb(struct super_block *sb);
bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op); bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
......
...@@ -230,12 +230,30 @@ static int orangefs_inode_type(enum orangefs_ds_type objtype) ...@@ -230,12 +230,30 @@ static int orangefs_inode_type(enum orangefs_ds_type objtype)
return -1; 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_sys_attr_s *attrs, char *link_target)
{ {
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
int type = orangefs_inode_type(attrs->objtype); int type = orangefs_inode_type(attrs->objtype);
if (!new) {
/* /*
* If the inode type or symlink target have changed then this * If the inode type or symlink target have changed then this
* inode is stale. * inode is stale.
...@@ -249,7 +267,6 @@ static int orangefs_inode_is_stale(struct inode *inode, int new, ...@@ -249,7 +267,6 @@ static int orangefs_inode_is_stale(struct inode *inode, int new,
orangefs_make_bad_inode(inode); orangefs_make_bad_inode(inode);
return 1; return 1;
} }
}
return 0; return 0;
} }
...@@ -294,16 +311,18 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, ...@@ -294,16 +311,18 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
if (ret != 0) if (ret != 0)
goto out; goto out;
type = orangefs_inode_type(new_op-> if (!new) {
downcall.resp.getattr.attributes.objtype); ret = orangefs_inode_is_stale(inode,
ret = orangefs_inode_is_stale(inode, new,
&new_op->downcall.resp.getattr.attributes, &new_op->downcall.resp.getattr.attributes,
new_op->downcall.resp.getattr.link_target); new_op->downcall.resp.getattr.link_target);
if (ret) { if (ret) {
ret = -ESTALE; ret = -ESTALE;
goto out; goto out;
} }
}
type = orangefs_inode_type(new_op->
downcall.resp.getattr.attributes.objtype);
switch (type) { switch (type) {
case S_IFREG: case S_IFREG:
inode->i_flags = orangefs_inode_flags(&new_op-> inode->i_flags = orangefs_inode_flags(&new_op->
...@@ -348,6 +367,12 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass, ...@@ -348,6 +367,12 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
inode->i_link = orangefs_inode->link_target; inode->i_link = orangefs_inode->link_target;
} }
break; 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-> inode->i_uid = make_kuid(&init_user_ns, new_op->
...@@ -401,7 +426,7 @@ int orangefs_inode_check_changed(struct inode *inode) ...@@ -401,7 +426,7 @@ int orangefs_inode_check_changed(struct inode *inode)
if (ret != 0) if (ret != 0)
goto out; 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.attributes,
new_op->downcall.resp.getattr.link_target); new_op->downcall.resp.getattr.link_target);
out: out:
...@@ -444,25 +469,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr) ...@@ -444,25 +469,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr)
return ret; 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 * The following is a very dirty hack that is now a permanent part of the
* ORANGEFS protocol. See protocol.h for more error definitions. * ORANGEFS protocol. See protocol.h for more error definitions.
...@@ -537,6 +543,7 @@ int orangefs_normalize_to_errno(__s32 error_code) ...@@ -537,6 +543,7 @@ int orangefs_normalize_to_errno(__s32 error_code)
*/ */
} else { } else {
gossip_err("orangefs: orangefs_normalize_to_errno: got error code which is not from ORANGEFS.\n"); gossip_err("orangefs: orangefs_normalize_to_errno: got error code which is not from ORANGEFS.\n");
error_code = -EINVAL;
} }
return error_code; return error_code;
} }
......
...@@ -395,13 +395,6 @@ struct ORANGEFS_dev_map_desc { ...@@ -395,13 +395,6 @@ struct ORANGEFS_dev_map_desc {
/* gossip.h *****************************************************************/ /* 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; extern __u64 orangefs_gossip_debug_mask;
/* try to avoid function call overhead by checking masks in macro */ /* try to avoid function call overhead by checking masks in macro */
...@@ -410,13 +403,5 @@ do { \ ...@@ -410,13 +403,5 @@ do { \
if (orangefs_gossip_debug_mask & (mask)) \ if (orangefs_gossip_debug_mask & (mask)) \
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
} while (0) } 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_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, ...@@ -335,7 +335,7 @@ static int orangefs_encode_fh(struct inode *inode,
struct orangefs_object_kref refn; struct orangefs_object_kref refn;
if (*max_len < len) { 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; *max_len = len;
type = 255; type = 255;
goto out; goto out;
...@@ -383,7 +383,7 @@ static int orangefs_unmount(int id, __s32 fs_id, const char *devname) ...@@ -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.id = id;
op->upcall.req.fs_umount.fs_id = fs_id; op->upcall.req.fs_umount.fs_id = fs_id;
strncpy(op->upcall.req.fs_umount.orangefs_config_server, 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); r = service_operation(op, "orangefs_fs_umount", 0);
/* Not much to do about an error here. */ /* Not much to do about an error here. */
if (r) if (r)
...@@ -478,7 +478,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst, ...@@ -478,7 +478,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
strncpy(new_op->upcall.req.fs_mount.orangefs_config_server, strncpy(new_op->upcall.req.fs_mount.orangefs_config_server,
devname, devname,
ORANGEFS_MAX_SERVER_ADDR_LEN); ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
gossip_debug(GOSSIP_SUPER_DEBUG, gossip_debug(GOSSIP_SUPER_DEBUG,
"Attempting ORANGEFS Mount via host %s\n", "Attempting ORANGEFS Mount via host %s\n",
...@@ -520,7 +520,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst, ...@@ -520,7 +520,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
*/ */
strncpy(ORANGEFS_SB(sb)->devname, strncpy(ORANGEFS_SB(sb)->devname,
devname, devname,
ORANGEFS_MAX_SERVER_ADDR_LEN); ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
/* mount_pending must be cleared */ /* mount_pending must be cleared */
ORANGEFS_SB(sb)->mount_pending = 0; ORANGEFS_SB(sb)->mount_pending = 0;
......
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