aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2016-05-19 20:33:17 -0400
committerDave Chinner <david@fromorbit.com>2016-05-19 20:33:17 -0400
commit2a4ad5894c819978dca5595396d54d51c3aca694 (patch)
tree62fcfac878219b36da9156785d832184194fd98a /fs/xfs
parenta7792aad644a259375002db8c9d9e03fd50bf509 (diff)
parent6e3e6d55e51774ec7cfc24975749bbddb28a9051 (diff)
Merge branch 'xfs-4.7-misc-fixes' into for-next
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/kmem.c26
-rw-r--r--fs/xfs/kmem.h2
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c10
-rw-r--r--fs/xfs/xfs_dquot.c2
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_inode_item.c2
-rw-r--r--fs/xfs/xfs_log.c4
-rw-r--r--fs/xfs/xfs_log_recover.c2
-rw-r--r--fs/xfs/xfs_mount.c1
-rw-r--r--fs/xfs/xfs_trace.h10
10 files changed, 32 insertions, 29 deletions
diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
index 686ba6fb20dd..339c696bbc01 100644
--- a/fs/xfs/kmem.c
+++ b/fs/xfs/kmem.c
@@ -93,19 +93,23 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags)
93} 93}
94 94
95void * 95void *
96kmem_realloc(const void *ptr, size_t newsize, size_t oldsize, 96kmem_realloc(const void *old, size_t newsize, xfs_km_flags_t flags)
97 xfs_km_flags_t flags)
98{ 97{
99 void *new; 98 int retries = 0;
99 gfp_t lflags = kmem_flags_convert(flags);
100 void *ptr;
100 101
101 new = kmem_alloc(newsize, flags); 102 do {
102 if (ptr) { 103 ptr = krealloc(old, newsize, lflags);
103 if (new) 104 if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP)))
104 memcpy(new, ptr, 105 return ptr;
105 ((oldsize < newsize) ? oldsize : newsize)); 106 if (!(++retries % 100))
106 kmem_free(ptr); 107 xfs_err(NULL,
107 } 108 "%s(%u) possible memory allocation deadlock size %zu in %s (mode:0x%x)",
108 return new; 109 current->comm, current->pid,
110 newsize, __func__, lflags);
111 congestion_wait(BLK_RW_ASYNC, HZ/50);
112 } while (1);
109} 113}
110 114
111void * 115void *
diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h
index d1c66e465ca5..689f746224e7 100644
--- a/fs/xfs/kmem.h
+++ b/fs/xfs/kmem.h
@@ -62,7 +62,7 @@ kmem_flags_convert(xfs_km_flags_t flags)
62 62
63extern void *kmem_alloc(size_t, xfs_km_flags_t); 63extern void *kmem_alloc(size_t, xfs_km_flags_t);
64extern void *kmem_zalloc_large(size_t size, xfs_km_flags_t); 64extern void *kmem_zalloc_large(size_t size, xfs_km_flags_t);
65extern void *kmem_realloc(const void *, size_t, size_t, xfs_km_flags_t); 65extern void *kmem_realloc(const void *, size_t, xfs_km_flags_t);
66static inline void kmem_free(const void *ptr) 66static inline void kmem_free(const void *ptr)
67{ 67{
68 kvfree(ptr); 68 kvfree(ptr);
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 4fbe2263c1fc..d3d1477bfb9e 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -542,7 +542,6 @@ xfs_iroot_realloc(
542 new_max = cur_max + rec_diff; 542 new_max = cur_max + rec_diff;
543 new_size = XFS_BMAP_BROOT_SPACE_CALC(mp, new_max); 543 new_size = XFS_BMAP_BROOT_SPACE_CALC(mp, new_max);
544 ifp->if_broot = kmem_realloc(ifp->if_broot, new_size, 544 ifp->if_broot = kmem_realloc(ifp->if_broot, new_size,
545 XFS_BMAP_BROOT_SPACE_CALC(mp, cur_max),
546 KM_SLEEP | KM_NOFS); 545 KM_SLEEP | KM_NOFS);
547 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, 546 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
548 ifp->if_broot_bytes); 547 ifp->if_broot_bytes);
@@ -686,7 +685,6 @@ xfs_idata_realloc(
686 ifp->if_u1.if_data = 685 ifp->if_u1.if_data =
687 kmem_realloc(ifp->if_u1.if_data, 686 kmem_realloc(ifp->if_u1.if_data,
688 real_size, 687 real_size,
689 ifp->if_real_bytes,
690 KM_SLEEP | KM_NOFS); 688 KM_SLEEP | KM_NOFS);
691 } 689 }
692 } else { 690 } else {
@@ -1402,8 +1400,7 @@ xfs_iext_realloc_direct(
1402 if (rnew_size != ifp->if_real_bytes) { 1400 if (rnew_size != ifp->if_real_bytes) {
1403 ifp->if_u1.if_extents = 1401 ifp->if_u1.if_extents =
1404 kmem_realloc(ifp->if_u1.if_extents, 1402 kmem_realloc(ifp->if_u1.if_extents,
1405 rnew_size, 1403 rnew_size, KM_NOFS);
1406 ifp->if_real_bytes, KM_NOFS);
1407 } 1404 }
1408 if (rnew_size > ifp->if_real_bytes) { 1405 if (rnew_size > ifp->if_real_bytes) {
1409 memset(&ifp->if_u1.if_extents[ifp->if_bytes / 1406 memset(&ifp->if_u1.if_extents[ifp->if_bytes /
@@ -1487,9 +1484,8 @@ xfs_iext_realloc_indirect(
1487 if (new_size == 0) { 1484 if (new_size == 0) {
1488 xfs_iext_destroy(ifp); 1485 xfs_iext_destroy(ifp);
1489 } else { 1486 } else {
1490 ifp->if_u1.if_ext_irec = (xfs_ext_irec_t *) 1487 ifp->if_u1.if_ext_irec =
1491 kmem_realloc(ifp->if_u1.if_ext_irec, 1488 kmem_realloc(ifp->if_u1.if_ext_irec, new_size, KM_NOFS);
1492 new_size, size, KM_NOFS);
1493 } 1489 }
1494} 1490}
1495 1491
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 23e24329b132..e0646659ce16 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -691,7 +691,7 @@ error0:
691 * end of the chunk, skip ahead to first id in next allocated chunk 691 * end of the chunk, skip ahead to first id in next allocated chunk
692 * using the SEEK_DATA interface. 692 * using the SEEK_DATA interface.
693 */ 693 */
694int 694static int
695xfs_dq_get_next_id( 695xfs_dq_get_next_id(
696 xfs_mount_t *mp, 696 xfs_mount_t *mp,
697 uint type, 697 uint type,
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index ca270d9bbb90..f79ea594fbf2 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1030,7 +1030,7 @@ xfs_dir_ialloc(
1030 tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY); 1030 tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY);
1031 } 1031 }
1032 1032
1033 code = xfs_trans_roll(&tp, 0); 1033 code = xfs_trans_roll(&tp, NULL);
1034 if (committed != NULL) 1034 if (committed != NULL)
1035 *committed = 1; 1035 *committed = 1;
1036 1036
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 37e23c7a5684..a1b07612224c 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -479,6 +479,8 @@ STATIC uint
479xfs_inode_item_push( 479xfs_inode_item_push(
480 struct xfs_log_item *lip, 480 struct xfs_log_item *lip,
481 struct list_head *buffer_list) 481 struct list_head *buffer_list)
482 __releases(&lip->li_ailp->xa_lock)
483 __acquires(&lip->li_ailp->xa_lock)
482{ 484{
483 struct xfs_inode_log_item *iip = INODE_ITEM(lip); 485 struct xfs_inode_log_item *iip = INODE_ITEM(lip);
484 struct xfs_inode *ip = iip->ili_inode; 486 struct xfs_inode *ip = iip->ili_inode;
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 268f7d65cfd4..bde02f1fba73 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3325,7 +3325,7 @@ xfs_log_force(
3325{ 3325{
3326 int error; 3326 int error;
3327 3327
3328 trace_xfs_log_force(mp, 0); 3328 trace_xfs_log_force(mp, 0, _RET_IP_);
3329 error = _xfs_log_force(mp, flags, NULL); 3329 error = _xfs_log_force(mp, flags, NULL);
3330 if (error) 3330 if (error)
3331 xfs_warn(mp, "%s: error %d returned.", __func__, error); 3331 xfs_warn(mp, "%s: error %d returned.", __func__, error);
@@ -3474,7 +3474,7 @@ xfs_log_force_lsn(
3474{ 3474{
3475 int error; 3475 int error;
3476 3476
3477 trace_xfs_log_force(mp, lsn); 3477 trace_xfs_log_force(mp, lsn, _RET_IP_);
3478 error = _xfs_log_force_lsn(mp, lsn, flags, NULL); 3478 error = _xfs_log_force_lsn(mp, lsn, flags, NULL);
3479 if (error) 3479 if (error)
3480 xfs_warn(mp, "%s: error %d returned.", __func__, error); 3480 xfs_warn(mp, "%s: error %d returned.", __func__, error);
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 558f3d1d91ad..835997843846 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3843,7 +3843,7 @@ xlog_recover_add_to_cont_trans(
3843 old_ptr = item->ri_buf[item->ri_cnt-1].i_addr; 3843 old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
3844 old_len = item->ri_buf[item->ri_cnt-1].i_len; 3844 old_len = item->ri_buf[item->ri_cnt-1].i_len;
3845 3845
3846 ptr = kmem_realloc(old_ptr, len+old_len, old_len, KM_SLEEP); 3846 ptr = kmem_realloc(old_ptr, len + old_len, KM_SLEEP);
3847 memcpy(&ptr[old_len], dp, len); 3847 memcpy(&ptr[old_len], dp, len);
3848 item->ri_buf[item->ri_cnt-1].i_len += len; 3848 item->ri_buf[item->ri_cnt-1].i_len += len;
3849 item->ri_buf[item->ri_cnt-1].i_addr = ptr; 3849 item->ri_buf[item->ri_cnt-1].i_addr = ptr;
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 536a0ee9cd5a..654799f716fc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -89,7 +89,6 @@ xfs_uuid_mount(
89 if (hole < 0) { 89 if (hole < 0) {
90 xfs_uuid_table = kmem_realloc(xfs_uuid_table, 90 xfs_uuid_table = kmem_realloc(xfs_uuid_table,
91 (xfs_uuid_table_size + 1) * sizeof(*xfs_uuid_table), 91 (xfs_uuid_table_size + 1) * sizeof(*xfs_uuid_table),
92 xfs_uuid_table_size * sizeof(*xfs_uuid_table),
93 KM_SLEEP); 92 KM_SLEEP);
94 hole = xfs_uuid_table_size++; 93 hole = xfs_uuid_table_size++;
95 } 94 }
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index f08129444280..840d52e38f10 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1050,19 +1050,21 @@ DECLARE_EVENT_CLASS(xfs_log_item_class,
1050) 1050)
1051 1051
1052TRACE_EVENT(xfs_log_force, 1052TRACE_EVENT(xfs_log_force,
1053 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn), 1053 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1054 TP_ARGS(mp, lsn), 1054 TP_ARGS(mp, lsn, caller_ip),
1055 TP_STRUCT__entry( 1055 TP_STRUCT__entry(
1056 __field(dev_t, dev) 1056 __field(dev_t, dev)
1057 __field(xfs_lsn_t, lsn) 1057 __field(xfs_lsn_t, lsn)
1058 __field(unsigned long, caller_ip)
1058 ), 1059 ),
1059 TP_fast_assign( 1060 TP_fast_assign(
1060 __entry->dev = mp->m_super->s_dev; 1061 __entry->dev = mp->m_super->s_dev;
1061 __entry->lsn = lsn; 1062 __entry->lsn = lsn;
1063 __entry->caller_ip = caller_ip;
1062 ), 1064 ),
1063 TP_printk("dev %d:%d lsn 0x%llx", 1065 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
1064 MAJOR(__entry->dev), MINOR(__entry->dev), 1066 MAJOR(__entry->dev), MINOR(__entry->dev),
1065 __entry->lsn) 1067 __entry->lsn, (void *)__entry->caller_ip)
1066) 1068)
1067 1069
1068#define DEFINE_LOG_ITEM_EVENT(name) \ 1070#define DEFINE_LOG_ITEM_EVENT(name) \