From: David Chinner <dgc@sgi.com>
To: xfs-dev <xfs-dev@sgi.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: [patch] remove xattr buffer size dependency on page size in xfsdump
Date: Thu, 22 May 2008 16:14:02 +1000 [thread overview]
Message-ID: <20080522061402.GS173056135@sgi.com> (raw)
The extended attr buffer size used by xfsdump is based on page size.
The maximum buffer size the kernel will accept is 64k. On a 64k page
machine, the default buffer size will be rejected by the kernel, thereby
breaking dump and restore.
Limit the buffer size to XATTR_LIST_MAX in dump, restore and libhandle
so the kernel won't reject otherwise valid requests.
Signed-off-by: Dave Chinner <dgc@sgi.com>
---
xfsdump/dump/content.c | 2 +-
xfsprogs/libhandle/handle.c | 5 ++++-
xfsprogs/libhandle/jdm.c | 4 ++++
3 files changed, 9 insertions(+), 2 deletions(-)
Index: xfs-cmds/xfsdump/dump/content.c
===================================================================
--- xfs-cmds.orig/xfsdump/dump/content.c 2007-02-03 01:26:21.000000000 +1100
+++ xfs-cmds/xfsdump/dump/content.c 2008-05-13 08:46:04.673298673 +1000
@@ -210,7 +210,7 @@ typedef struct extent_group_context exte
/* minimum sizes for extended attributes buffers
*/
-#define EXTATTR_LISTBUF_SZ ( 4 * pgsz )
+#define EXTATTR_LISTBUF_SZ ( XATTR_LIST_MAX )
#define EXTATTR_RTRVARRAY_LEN ( 1 * pgsz )
#define EXTATTR_DUMPBUF_SZ ( 4 * pgsz )
Index: xfs-cmds/xfsprogs/libhandle/handle.c
===================================================================
--- xfs-cmds.orig/xfsprogs/libhandle/handle.c 2006-11-15 19:00:31.000000000 +1100
+++ xfs-cmds/xfsprogs/libhandle/handle.c 2008-05-13 08:52:07.150983837 +1000
@@ -360,8 +360,11 @@ attr_list_by_handle(
memcpy(&alhreq.pos, cursor, sizeof(alhreq.pos));
alhreq.flags = flags;
- alhreq.buflen = bufsize;
alhreq.buffer = buf;
+ alhreq.buflen = bufsize;
+ /* prevent needless EINVAL from the kernel */
+ if (alhreq.buflen > XATTR_LIST_MAX)
+ alhreq.buflen = XATTR_LIST_MAX;
error = xfsctl(path, fd, XFS_IOC_ATTRLIST_BY_HANDLE, &alhreq);
Index: xfs-cmds/xfsprogs/libhandle/jdm.c
===================================================================
--- xfs-cmds.orig/xfsprogs/libhandle/jdm.c 2008-04-16 13:04:05.000000000 +1000
+++ xfs-cmds/xfsprogs/libhandle/jdm.c 2008-05-13 08:51:23.344565394 +1000
@@ -166,6 +166,10 @@ jdm_attr_list( jdm_fshandle_t *fshp,
filehandle_t filehandle;
int rval;
+ /* prevent needless EINVAL from the kernel */
+ if (bufsz > XATTR_LIST_MAX)
+ bufsz = XATTR_LIST_MAX;
+
jdm_fill_filehandle( &filehandle, fshandlep, statp );
rval = attr_list_by_handle (( void * )&filehandle,
sizeof( filehandle ),
next reply other threads:[~2008-05-22 6:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-22 6:14 David Chinner [this message]
2008-05-22 13:28 ` [patch] remove xattr buffer size dependency on page size in xfsdump Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080522061402.GS173056135@sgi.com \
--to=dgc@sgi.com \
--cc=xfs-dev@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox