/* * Copyright (c) 2016 Trond Myklebust * * I/O and data path helper functionality. */ #include #include #include #include #include #include #include "internal.h" /* Call with exclusively locked inode->i_rwsem */ static void nfs_block_o_direct(struct nfs_inode *nfsi, struct inode *inode) { if (test_bit(NFS_INO_ODIRECT, &nfsi->flags)) { clear_bit(NFS_INO_ODIRECT, &nfsi->flags); inode_dio_wait(inode); } } /** * nfs_start_io_read - declare the file is being used for buffered reads * @inode - file inode * * Declare that a buffered read operation is about to start, and ensure * that we block all direct I/O. * On exit, the function ensures that the NFS_INO_ODIRECT flag is unset, * and holds a shared lock on inode->i_rwsem to ensure that the flag * cannot be changed. * In practice, this means that buffered read operations are allowed to * execute in parallel, thanks to the shared lock, whereas direct I/O * operations need to wait to grab an exclusive lock in order to set * NFS_INO_ODIRECT. * Note that buffered writes and truncates both take a write lock on * inode->i_rwsem, meaning that those are serialised w.r.t. the reads. */ void nfs_start_io_read(struct inode *inode) { struct nfs_inode *nfsi = NFS_I(inode); /* Be an optimist! */ down_read(&inode->i_rwsem); if (test_bit(NFS_INO_ODIRECT, &nfsi->flags) == 0) return; up_read(&inode->i_rwsem); /* Slow path.... */ down_write(&inode->i_rwsem); nfs_block_o_direct(nfsi, inode); downgrade_write(&inode->i_rwsem); } /** * nfs_end_io_read - declare that the buffered read operation is done * @inode - file inode * * Declare that a buffered read operation is done, and release the shared * lock on inode->i_rwsem. */ void nfs_end_io_read(struct inode *inode) { up_read(&inode->i_rwsem); } /** * nfs_start_io_write - declare the file is being used for buffered writes * @inode - file inode * * Declare that a buffered read operation is about to start, and ensure * that we block all direct I/O. */ void nfs_start_io_write(struct inode *inode) { down_write(&inode->i_rwsem); nfs_block_o_direct(NFS_I(inode), inode); } /** * nfs_end_io_write - declare that the buffered write operation is done * @inode - file inode * * Declare that a buffered write operation is done, and release the * lock on inode->i_rwsem. */ void nfs_end_io_write(struct inode *inode) { up_write(&inode->i_rwsem); } /* Call with exclusively locked inode->i_rwsem */ static void nfs_block_buffered(struct nfs_inode *nfsi, struct inode *inode) { if (!test_bit(NFS_INO_ODIRECT, &nfsi->flags)) { set_bit(NFS_INO_ODIRECT, &nfsi->flags); nfs_wb_all(inode); } } /** * nfs_end_io_direct - declare the file is being used for direct i/o * @inode - file inode * * Declare that a direct I/O operation is about to start, and ensure * that we block all buffered I/O. * On exit, the function ensures that the NFS_INO_ODIRECT flag is set, * and holds a shared lock on inode->i_rwsem to ensure that the flag * cannot be changed. * In practice, this means that direct I/O operations are allowed to * execute in parallel, thanks to the shared lock, whereas buffered I/O * operations need to wait to grab an exclusive lock in order to clear * NFS_INO_ODIRECT. * Note that buffered writes and truncates both take a write lock on * inode->i_rwsem, meaning that those are serialised w.r.t. O_DIRECT. */ void nfs_start_io_direct(struct inode *inode) { struct nfs_inode *nfsi = NFS_I(inode); /* Be an optimist! */ down_read(&inode->i_rwsem); if (test_bit(NFS_INO_ODIRECT, &nfsi->flags) != 0) return; up_read(&inode->i_rwsem); /* Slow path.... */ down_write(&inode->i_rwsem); nfs_block_buffered(nfsi, inode); downgrade_write(&inode->i_rwsem); } /** * nfs_end_io_direct - declare that the direct i/o operation is done * @inode - file inode * * Declare that a direct I/O operation is done, and release the shared * lock on inode->i_rwsem. */ void nfs_end_io_direct(struct inode *inode) { up_read(&inode->i_rwsem); } ws' onchange='this.form.submit();'>mode:
authorJacob Pan <jacob.jun.pan@linux.intel.com>2014-04-29 00:35:54 -0700
committerZhang Rui <rui.zhang@intel.com>2014-05-15 17:02:18 +0800
commit9a17f56c590cfd0d5b47f3ffa89c297534962e8f (patch)
tree1acb25cc4eb5cec8dffd41a7768d41122b323b44 /Documentation/devicetree/bindings
parent09be511cdab813c2971c9f9af0cb40f6583cf80d (diff)
thermal/intel_powerclamp: add newer cpu ids
Add support for Broadwell and Valleyview CPUs Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Diffstat (limited to 'Documentation/devicetree/bindings')
s us to refer to an anonymous set from a batch. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-12netfilter: nf_tables: add check_genid to the nfnetlink subsystemPablo Neira Ayuso1-0/+6
This patch implements the check generation id as provided by nfnetlink. This allows us to reject ruleset updates against stale baseline, so userspace can retry update with a fresh ruleset cache. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-12netfilter: nfnetlink: allow to check for generation IDPablo Neira Ayuso1-4/+27
This patch allows userspace to specify the generation ID that has been used to build an incremental batch update. If userspace specifies the generation ID in the batch message as attribute, then nfnetlink compares it to the current generation ID so you make sure that you work against the right baseline. Otherwise, bail out with ERESTART so userspace knows that its changeset is stale and needs to respin. Userspace can do this transparently at the cost of taking slightly more time to refresh caches and rework the changeset. This check is optional, if there is no NFNL_BATCH_GENID attribute in the batch begin message, then no check is performed. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-12netfilter: nfnetlink: add nfnetlink_rcv_skb_batch()Pablo Neira Ayuso1-23/+28
Add new nfnetlink_rcv_skb_batch() to wrap initial nfnetlink batch handling. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-12netfilter: nfnetlink: get rid of u_intX_t typesPablo Neira Ayuso1-8/+8
Use uX types instead. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-12netfilter: nf_ct_expect: nf_ct_expect_insert() returns voidGao Feng1-5/+3
Because nf_ct_expect_insert() always succeeds now, its return value can be just void instead of int. And remove code that checks for its return value. Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-12netfilter: nf_ct_sip: Use mod_timer_pending()Gao Feng1-7/+5
timer_del() followed by timer_add() can be replaced by mod_timer_pending(). Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2017-02-11net_sched: fix error recovery at qdisc creationEric Dumazet5-23/+19
Dmitry reported uses after free in qdisc code [1] The problem here is that ops->init() can return an error. qdisc_create_dflt() then call ops->destroy(), while qdisc_create() does _not_ call it. Four qdisc chose to call their own ops->destroy(), assuming their caller would not. This patch makes sure qdisc_create() calls ops->destroy() and fixes the four qdisc to avoid double free. [1] BUG: KASAN: use-after-free in mq_destroy+0x242/0x290 net/sched/sch_mq.c:33 at addr ffff8801d415d440 Read of size 8 by task syz-executor2/5030 CPU: 0 PID: 5030 Comm: syz-executor2 Not tainted 4.3.5-smp-DEV #119 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 0000000000000046 ffff8801b435b870 ffffffff81bbbed4 ffff8801db000400 ffff8801d415d440 ffff8801d415dc40 ffff8801c4988510 ffff8801b435b898 ffffffff816682b1 ffff8801b435b928 ffff8801d415d440 ffff8801c49880c0 Call Trace: [<ffffffff81bbbed4>] __dump_stack lib/dump_stack.c:15 [inline] [<ffffffff81bbbed4>] dump_stack+0x6c/0x98 lib/dump_stack.c:51 [<ffffffff816682b1>] kasan_object_err+0x21/0x70 mm/kasan/report.c:158 [<ffffffff81668524>] print_address_description mm/kasan/report.c:196 [inline] [<ffffffff81668524>] kasan_report_error+0x1b4/0x4b0 mm/kasan/report.c:285 [<ffffffff81668953>] kasan_report mm/kasan/report.c:305 [inline] [<ffffffff81668953>] __asan_report_load8_noabort+0x43/0x50 mm/kasan/report.c:326 [<ffffffff82527b02>] mq_destroy+0x242/0x290 net/sched/sch_mq.c:33 [<ffffffff82524bdd>] qdisc_destroy+0x12d/0x290 net/sched/sch_generic.c:953 [<ffffffff82524e30>] qdisc_create_dflt+0xf0/0x120 net/sched/sch_generic.c:848 [<ffffffff8252550d>] attach_default_qdiscs net/sched/sch_generic.c:1029 [inline] [<ffffffff8252550d>] dev_activate+0x6ad/0x880 net/sched/sch_generic.c:1064 [<ffffffff824b1db1>] __dev_open+0x221/0x320 net/core/dev.c:1403 [<ffffffff824b24ce>] __dev_change_flags+0x15e/0x3e0 net/core/dev.c:6858 [<ffffffff824b27de>] dev_change_flags+0x8e/0x140 net/core/dev.c:6926 [<ffffffff824f5bf6>] dev_ifsioc+0x446/0x890 net/core/dev_ioctl.c:260 [<ffffffff824f61fa>] dev_ioctl+0x1ba/0xb80 net/core/dev_ioctl.c:546 [<ffffffff82430509>] sock_do_ioctl+0x99/0xb0 net/socket.c:879 [<ffffffff82430d30>] sock_ioctl+0x2a0/0x390 net/socket.c:958 [<ffffffff816f3b68>] vfs_ioctl fs/ioctl.c:44 [inline] [<ffffffff816f3b68>] do_vfs_ioctl+0x8a8/0xe50 fs/ioctl.c:611 [<ffffffff816f41a4>] SYSC_ioctl fs/ioctl.c:626 [inline] [<ffffffff816f41a4>] SyS_ioctl+0x94/0xc0 fs/ioctl.c:617 [<ffffffff8123e357>] entry_SYSCALL_64_fastpath+0x12/0x17 Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-11net: rename dst_neigh_output back to neigh_outputJulian Anastasov2-2/+2
After the dst->pending_confirm flag was removed, we do not need anymore to provide dst arg to dst_neigh_output. So, rename it to neigh_output as before commit 5110effee8fd ("net: Do delayed neigh confirmation."). Signed-off-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller