diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 5e0bf81b8..082418e74 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1695,7 +1695,7 @@ static int tx_padding(struct iscsi_cmnd *cmnd, int state) TRACE_DBG("Sending %d padding bytes (cmd %p)", rest, cmnd); - iov.iov_base = (char *)(&padding) + (sizeof(uint32_t) - rest); + iov.iov_base = (char *)&padding; iov.iov_len = rest; res = kernel_sendmsg(cmnd->conn->sock, &msg, &iov, 1, rest); diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 1f7d4eac5..4203aaee7 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1649,7 +1649,12 @@ struct sgv_pool *sgv_pool_create_node(const char *name, } } - pool = kmem_cache_alloc_node(sgv_pool_cachep, GFP_KERNEL, nodeid); + /* + * __sgv_shrink() takes sgv_pools_mutex, so, to prevent deadlock with it + * if this allocation will try to reclaim memory, GFP_NOFS has to be used + * here. + */ + pool = kmem_cache_alloc_node(sgv_pool_cachep, GFP_KERNEL|GFP_NOFS, nodeid); if (pool == NULL) { PRINT_ERROR("Allocation of sgv_pool failed (size %zd)", sizeof(*pool));