Commit 3ea22a71 authored by Miklos Szeredi's avatar Miklos Szeredi

ovl: allow setting max size of redirect

Add a module option to allow tuning the max size of absolute redirects.
Default is 256.

Size of relative redirects is naturally limited by the the underlying
filesystem's max filename length (usually 255).
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 688ea0e5
...@@ -12,12 +12,18 @@ ...@@ -12,12 +12,18 @@
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/cred.h> #include <linux/cred.h>
#include <linux/module.h>
#include <linux/posix_acl.h> #include <linux/posix_acl.h>
#include <linux/posix_acl_xattr.h> #include <linux/posix_acl_xattr.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include "overlayfs.h" #include "overlayfs.h"
static unsigned short ovl_redirect_max = 256;
module_param_named(redirect_max, ovl_redirect_max, ushort, 0644);
MODULE_PARM_DESC(ovl_redirect_max,
"Maximum length of absolute redirect xattr value");
void ovl_cleanup(struct inode *wdir, struct dentry *wdentry) void ovl_cleanup(struct inode *wdir, struct dentry *wdentry)
{ {
int err; int err;
...@@ -777,13 +783,11 @@ static bool ovl_can_move(struct dentry *dentry) ...@@ -777,13 +783,11 @@ static bool ovl_can_move(struct dentry *dentry)
!d_is_dir(dentry) || !ovl_type_merge_or_lower(dentry); !d_is_dir(dentry) || !ovl_type_merge_or_lower(dentry);
} }
#define OVL_REDIRECT_MAX 256
static char *ovl_get_redirect(struct dentry *dentry, bool samedir) static char *ovl_get_redirect(struct dentry *dentry, bool samedir)
{ {
char *buf, *ret; char *buf, *ret;
struct dentry *d, *tmp; struct dentry *d, *tmp;
int buflen = OVL_REDIRECT_MAX + 1; int buflen = ovl_redirect_max + 1;
if (samedir) { if (samedir) {
ret = kstrndup(dentry->d_name.name, dentry->d_name.len, ret = kstrndup(dentry->d_name.name, dentry->d_name.len,
......
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