mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6: NFS: Fix another nfs_wb_page() deadlock NFS: Ensure that we mark the inode as dirty if we exit early from commit NFS: Fix a lock imbalance typo in nfs_access_cache_shrinker sunrpc: fix leak on error on socket xprt setup
This commit is contained in:
commit
ade61088bc
@ -1741,6 +1741,7 @@ remove_lru_entry:
|
|||||||
clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags);
|
clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags);
|
||||||
smp_mb__after_clear_bit();
|
smp_mb__after_clear_bit();
|
||||||
}
|
}
|
||||||
|
spin_unlock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
spin_unlock(&nfs_access_lru_lock);
|
spin_unlock(&nfs_access_lru_lock);
|
||||||
nfs_access_free_list(&head);
|
nfs_access_free_list(&head);
|
||||||
|
@ -1386,7 +1386,7 @@ static int nfs_commit_inode(struct inode *inode, int how)
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if (!nfs_commit_set_lock(NFS_I(inode), may_wait))
|
if (!nfs_commit_set_lock(NFS_I(inode), may_wait))
|
||||||
goto out;
|
goto out_mark_dirty;
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
res = nfs_scan_commit(inode, &head, 0, 0);
|
res = nfs_scan_commit(inode, &head, 0, 0);
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
@ -1398,9 +1398,18 @@ static int nfs_commit_inode(struct inode *inode, int how)
|
|||||||
wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT,
|
wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT,
|
||||||
nfs_wait_bit_killable,
|
nfs_wait_bit_killable,
|
||||||
TASK_KILLABLE);
|
TASK_KILLABLE);
|
||||||
|
else
|
||||||
|
goto out_mark_dirty;
|
||||||
} else
|
} else
|
||||||
nfs_commit_clear_lock(NFS_I(inode));
|
nfs_commit_clear_lock(NFS_I(inode));
|
||||||
out:
|
return res;
|
||||||
|
/* Note: If we exit without ensuring that the commit is complete,
|
||||||
|
* we must mark the inode as dirty. Otherwise, future calls to
|
||||||
|
* sync_inode() with the WB_SYNC_ALL flag set will fail to ensure
|
||||||
|
* that the data is on the disk.
|
||||||
|
*/
|
||||||
|
out_mark_dirty:
|
||||||
|
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1509,14 +1518,17 @@ int nfs_wb_page(struct inode *inode, struct page *page)
|
|||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while(PagePrivate(page)) {
|
for (;;) {
|
||||||
wait_on_page_writeback(page);
|
wait_on_page_writeback(page);
|
||||||
if (clear_page_dirty_for_io(page)) {
|
if (clear_page_dirty_for_io(page)) {
|
||||||
ret = nfs_writepage_locked(page, &wbc);
|
ret = nfs_writepage_locked(page, &wbc);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out_error;
|
goto out_error;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
ret = sync_inode(inode, &wbc);
|
if (!PagePrivate(page))
|
||||||
|
break;
|
||||||
|
ret = nfs_commit_inode(inode, FLUSH_SYNC);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out_error;
|
goto out_error;
|
||||||
}
|
}
|
||||||
|
@ -2293,6 +2293,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
|
|||||||
struct sockaddr *addr = args->dstaddr;
|
struct sockaddr *addr = args->dstaddr;
|
||||||
struct rpc_xprt *xprt;
|
struct rpc_xprt *xprt;
|
||||||
struct sock_xprt *transport;
|
struct sock_xprt *transport;
|
||||||
|
struct rpc_xprt *ret;
|
||||||
|
|
||||||
xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
|
xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
|
||||||
if (IS_ERR(xprt))
|
if (IS_ERR(xprt))
|
||||||
@ -2330,8 +2331,8 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
|
|||||||
xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6);
|
xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
kfree(xprt);
|
ret = ERR_PTR(-EAFNOSUPPORT);
|
||||||
return ERR_PTR(-EAFNOSUPPORT);
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xprt_bound(xprt))
|
if (xprt_bound(xprt))
|
||||||
@ -2346,10 +2347,11 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
|
|||||||
|
|
||||||
if (try_module_get(THIS_MODULE))
|
if (try_module_get(THIS_MODULE))
|
||||||
return xprt;
|
return xprt;
|
||||||
|
ret = ERR_PTR(-EINVAL);
|
||||||
|
out_err:
|
||||||
kfree(xprt->slot);
|
kfree(xprt->slot);
|
||||||
kfree(xprt);
|
kfree(xprt);
|
||||||
return ERR_PTR(-EINVAL);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct rpc_timeout xs_tcp_default_timeout = {
|
static const struct rpc_timeout xs_tcp_default_timeout = {
|
||||||
@ -2368,6 +2370,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
|
|||||||
struct sockaddr *addr = args->dstaddr;
|
struct sockaddr *addr = args->dstaddr;
|
||||||
struct rpc_xprt *xprt;
|
struct rpc_xprt *xprt;
|
||||||
struct sock_xprt *transport;
|
struct sock_xprt *transport;
|
||||||
|
struct rpc_xprt *ret;
|
||||||
|
|
||||||
xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
|
xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
|
||||||
if (IS_ERR(xprt))
|
if (IS_ERR(xprt))
|
||||||
@ -2403,8 +2406,8 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
|
|||||||
xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6);
|
xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
kfree(xprt);
|
ret = ERR_PTR(-EAFNOSUPPORT);
|
||||||
return ERR_PTR(-EAFNOSUPPORT);
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xprt_bound(xprt))
|
if (xprt_bound(xprt))
|
||||||
@ -2420,10 +2423,11 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
|
|||||||
|
|
||||||
if (try_module_get(THIS_MODULE))
|
if (try_module_get(THIS_MODULE))
|
||||||
return xprt;
|
return xprt;
|
||||||
|
ret = ERR_PTR(-EINVAL);
|
||||||
|
out_err:
|
||||||
kfree(xprt->slot);
|
kfree(xprt->slot);
|
||||||
kfree(xprt);
|
kfree(xprt);
|
||||||
return ERR_PTR(-EINVAL);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2437,6 +2441,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
|
|||||||
struct rpc_xprt *xprt;
|
struct rpc_xprt *xprt;
|
||||||
struct sock_xprt *transport;
|
struct sock_xprt *transport;
|
||||||
struct svc_sock *bc_sock;
|
struct svc_sock *bc_sock;
|
||||||
|
struct rpc_xprt *ret;
|
||||||
|
|
||||||
xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
|
xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
|
||||||
if (IS_ERR(xprt))
|
if (IS_ERR(xprt))
|
||||||
@ -2476,8 +2481,8 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
|
|||||||
RPCBIND_NETID_TCP6);
|
RPCBIND_NETID_TCP6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
kfree(xprt);
|
ret = ERR_PTR(-EAFNOSUPPORT);
|
||||||
return ERR_PTR(-EAFNOSUPPORT);
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xprt_bound(xprt))
|
if (xprt_bound(xprt))
|
||||||
@ -2499,9 +2504,11 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
|
|||||||
|
|
||||||
if (try_module_get(THIS_MODULE))
|
if (try_module_get(THIS_MODULE))
|
||||||
return xprt;
|
return xprt;
|
||||||
|
ret = ERR_PTR(-EINVAL);
|
||||||
|
out_err:
|
||||||
kfree(xprt->slot);
|
kfree(xprt->slot);
|
||||||
kfree(xprt);
|
kfree(xprt);
|
||||||
return ERR_PTR(-EINVAL);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xprt_class xs_udp_transport = {
|
static struct xprt_class xs_udp_transport = {
|
||||||
|
Loading…
Reference in New Issue
Block a user