aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2015-10-12 03:38:25 -0400
committerDave Chinner <david@fromorbit.com>2015-10-12 03:38:25 -0400
commit1e2103cbf4adfd5490ee5f3ee59750bd70d2047e (patch)
treefb8256698fc1098784ef0bedba22768a793679f4 /fs/xfs
parent8a56d7c305b9613dfe416fd1af06871ec34bb103 (diff)
parent847f9f6875fb02b576035e3dc31f5e647b7617a7 (diff)
Merge branch 'xfs-misc-fixes-for-4.4-1' into for-next
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/kmem.c10
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c2
-rw-r--r--fs/xfs/libxfs/xfs_btree.c4
-rw-r--r--fs/xfs/libxfs/xfs_format.h10
-rw-r--r--fs/xfs/libxfs/xfs_fs.h10
-rw-r--r--fs/xfs/xfs_buf.c3
-rw-r--r--fs/xfs/xfs_ioctl.c6
-rw-r--r--fs/xfs/xfs_ioctl32.c2
-rw-r--r--fs/xfs/xfs_message.c7
9 files changed, 41 insertions, 13 deletions
diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
index a7a3a63bb360..686ba6fb20dd 100644
--- a/fs/xfs/kmem.c
+++ b/fs/xfs/kmem.c
@@ -55,8 +55,9 @@ kmem_alloc(size_t size, xfs_km_flags_t flags)
55 return ptr; 55 return ptr;
56 if (!(++retries % 100)) 56 if (!(++retries % 100))
57 xfs_err(NULL, 57 xfs_err(NULL,
58 "possible memory allocation deadlock in %s (mode:0x%x)", 58 "%s(%u) possible memory allocation deadlock size %u in %s (mode:0x%x)",
59 __func__, lflags); 59 current->comm, current->pid,
60 (unsigned int)size, __func__, lflags);
60 congestion_wait(BLK_RW_ASYNC, HZ/50); 61 congestion_wait(BLK_RW_ASYNC, HZ/50);
61 } while (1); 62 } while (1);
62} 63}
@@ -120,8 +121,9 @@ kmem_zone_alloc(kmem_zone_t *zone, xfs_km_flags_t flags)
120 return ptr; 121 return ptr;
121 if (!(++retries % 100)) 122 if (!(++retries % 100))
122 xfs_err(NULL, 123 xfs_err(NULL,
123 "possible memory allocation deadlock in %s (mode:0x%x)", 124 "%s(%u) possible memory allocation deadlock in %s (mode:0x%x)",
124 __func__, lflags); 125 current->comm, current->pid,
126 __func__, lflags);
125 congestion_wait(BLK_RW_ASYNC, HZ/50); 127 congestion_wait(BLK_RW_ASYNC, HZ/50);
126 } while (1); 128 } while (1);
127} 129}
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index f38f9bd81557..5ab95ffa4ae9 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -107,7 +107,7 @@ xfs_attr3_rmt_verify(
107 if (be32_to_cpu(rmt->rm_bytes) > fsbsize - sizeof(*rmt)) 107 if (be32_to_cpu(rmt->rm_bytes) > fsbsize - sizeof(*rmt))
108 return false; 108 return false;
109 if (be32_to_cpu(rmt->rm_offset) + 109 if (be32_to_cpu(rmt->rm_offset) +
110 be32_to_cpu(rmt->rm_bytes) > XATTR_SIZE_MAX) 110 be32_to_cpu(rmt->rm_bytes) > XFS_XATTR_SIZE_MAX)
111 return false; 111 return false;
112 if (rmt->rm_owner == 0) 112 if (rmt->rm_owner == 0)
113 return false; 113 return false;
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 235d026c7f9c..af1bbee5586e 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -223,7 +223,7 @@ xfs_btree_check_ptr(
223 * long-form btree header. 223 * long-form btree header.
224 * 224 *
225 * Prior to calculting the CRC, pull the LSN out of the buffer log item and put 225 * Prior to calculting the CRC, pull the LSN out of the buffer log item and put
226 * it into the buffer so recovery knows what the last modifcation was that made 226 * it into the buffer so recovery knows what the last modification was that made
227 * it to disk. 227 * it to disk.
228 */ 228 */
229void 229void
@@ -261,7 +261,7 @@ xfs_btree_lblock_verify_crc(
261 * short-form btree header. 261 * short-form btree header.
262 * 262 *
263 * Prior to calculting the CRC, pull the LSN out of the buffer log item and put 263 * Prior to calculting the CRC, pull the LSN out of the buffer log item and put
264 * it into the buffer so recovery knows what the last modifcation was that made 264 * it into the buffer so recovery knows what the last modification was that made
265 * it to disk. 265 * it to disk.
266 */ 266 */
267void 267void
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 9590a069e556..8568de163004 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -60,6 +60,14 @@ struct xfs_ifork;
60#define XFS_SB_VERSION_MOREBITSBIT 0x8000 60#define XFS_SB_VERSION_MOREBITSBIT 0x8000
61 61
62/* 62/*
63 * The size of a single extended attribute on disk is limited by
64 * the size of index values within the attribute entries themselves.
65 * These are be16 fields, so we can only support attribute data
66 * sizes up to 2^16 bytes in length.
67 */
68#define XFS_XATTR_SIZE_MAX (1 << 16)
69
70/*
63 * Supported feature bit list is just all bits in the versionnum field because 71 * Supported feature bit list is just all bits in the versionnum field because
64 * we've used them all up and understand them all. Except, of course, for the 72 * we've used them all up and understand them all. Except, of course, for the
65 * shared superblock bit, which nobody knows what it does and so is unsupported. 73 * shared superblock bit, which nobody knows what it does and so is unsupported.
@@ -1483,7 +1491,7 @@ struct xfs_acl {
1483 */ 1491 */
1484#define XFS_ACL_MAX_ENTRIES(mp) \ 1492#define XFS_ACL_MAX_ENTRIES(mp) \
1485 (xfs_sb_version_hascrc(&mp->m_sb) \ 1493 (xfs_sb_version_hascrc(&mp->m_sb) \
1486 ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ 1494 ? (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
1487 sizeof(struct xfs_acl_entry) \ 1495 sizeof(struct xfs_acl_entry) \
1488 : 25) 1496 : 25)
1489 1497
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 89689c6a43e2..b2b73a998d42 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -490,6 +490,16 @@ typedef struct xfs_swapext
490#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */ 490#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */
491 491
492/* 492/*
493 * ioctl limits
494 */
495#ifdef XATTR_LIST_MAX
496# define XFS_XATTR_LIST_MAX XATTR_LIST_MAX
497#else
498# define XFS_XATTR_LIST_MAX 65536
499#endif
500
501
502/*
493 * ioctl commands that are used by Linux filesystems 503 * ioctl commands that are used by Linux filesystems
494 */ 504 */
495#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS 505#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 90815c22b22d..3243cdf97f33 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -354,7 +354,8 @@ retry:
354 */ 354 */
355 if (!(++retries % 100)) 355 if (!(++retries % 100))
356 xfs_err(NULL, 356 xfs_err(NULL,
357 "possible memory allocation deadlock in %s (mode:0x%x)", 357 "%s(%u) possible memory allocation deadlock in %s (mode:0x%x)",
358 current->comm, current->pid,
358 __func__, gfp_mask); 359 __func__, gfp_mask);
359 360
360 XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries); 361 XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries);
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index b67a130134fb..c88ddcadd656 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -411,7 +411,7 @@ xfs_attrlist_by_handle(
411 if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t))) 411 if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t)))
412 return -EFAULT; 412 return -EFAULT;
413 if (al_hreq.buflen < sizeof(struct attrlist) || 413 if (al_hreq.buflen < sizeof(struct attrlist) ||
414 al_hreq.buflen > XATTR_LIST_MAX) 414 al_hreq.buflen > XFS_XATTR_LIST_MAX)
415 return -EINVAL; 415 return -EINVAL;
416 416
417 /* 417 /*
@@ -455,7 +455,7 @@ xfs_attrmulti_attr_get(
455 unsigned char *kbuf; 455 unsigned char *kbuf;
456 int error = -EFAULT; 456 int error = -EFAULT;
457 457
458 if (*len > XATTR_SIZE_MAX) 458 if (*len > XFS_XATTR_SIZE_MAX)
459 return -EINVAL; 459 return -EINVAL;
460 kbuf = kmem_zalloc_large(*len, KM_SLEEP); 460 kbuf = kmem_zalloc_large(*len, KM_SLEEP);
461 if (!kbuf) 461 if (!kbuf)
@@ -485,7 +485,7 @@ xfs_attrmulti_attr_set(
485 485
486 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 486 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
487 return -EPERM; 487 return -EPERM;
488 if (len > XATTR_SIZE_MAX) 488 if (len > XFS_XATTR_SIZE_MAX)
489 return -EINVAL; 489 return -EINVAL;
490 490
491 kbuf = memdup_user(ubuf, len); 491 kbuf = memdup_user(ubuf, len);
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index b88bdc85dd3d..1a05d8ae327d 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -356,7 +356,7 @@ xfs_compat_attrlist_by_handle(
356 sizeof(compat_xfs_fsop_attrlist_handlereq_t))) 356 sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
357 return -EFAULT; 357 return -EFAULT;
358 if (al_hreq.buflen < sizeof(struct attrlist) || 358 if (al_hreq.buflen < sizeof(struct attrlist) ||
359 al_hreq.buflen > XATTR_LIST_MAX) 359 al_hreq.buflen > XFS_XATTR_LIST_MAX)
360 return -EINVAL; 360 return -EINVAL;
361 361
362 /* 362 /*
diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
index d8b67547ab34..11792d888e4e 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -17,6 +17,7 @@
17 17
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_error.h"
20#include "xfs_format.h" 21#include "xfs_format.h"
21#include "xfs_log_format.h" 22#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
@@ -43,6 +44,7 @@ void func(const struct xfs_mount *mp, const char *fmt, ...) \
43{ \ 44{ \
44 struct va_format vaf; \ 45 struct va_format vaf; \
45 va_list args; \ 46 va_list args; \
47 int level; \
46 \ 48 \
47 va_start(args, fmt); \ 49 va_start(args, fmt); \
48 \ 50 \
@@ -51,6 +53,11 @@ void func(const struct xfs_mount *mp, const char *fmt, ...) \
51 \ 53 \
52 __xfs_printk(kern_level, mp, &vaf); \ 54 __xfs_printk(kern_level, mp, &vaf); \
53 va_end(args); \ 55 va_end(args); \
56 \
57 if (!kstrtoint(kern_level, 0, &level) && \
58 level <= LOGLEVEL_ERR && \
59 xfs_error_level >= XFS_ERRLEVEL_HIGH) \
60 xfs_stack_trace(); \
54} \ 61} \
55 62
56define_xfs_printk_level(xfs_emerg, KERN_EMERG); 63define_xfs_printk_level(xfs_emerg, KERN_EMERG);