/* * Ceph cache definitions. * * Copyright (C) 2013 by Adfin Solutions, Inc. All Rights Reserved. * Written by Milosz Tanski (milosz@adfin.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to: * Free Software Foundation * 51 Franklin Street, Fifth Floor * Boston, MA 02111-1301 USA * */ #ifndef _CEPH_CACHE_H #define _CEPH_CACHE_H #ifdef CONFIG_CEPH_FSCACHE extern struct fscache_netfs ceph_cache_netfs; int ceph_fscache_register(void); void ceph_fscache_unregister(void); int ceph_fscache_register_fs(struct ceph_fs_client* fsc); void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc); void ceph_fscache_register_inode_cookie(struct inode *inode); void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci); void ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp); void ceph_fscache_revalidate_cookie(struct ceph_inode_info *ci); int ceph_readpage_from_fscache(struct inode *inode, struct page *page); int ceph_readpages_from_fscache(struct inode *inode, struct address_space *mapping, struct list_head *pages, unsigned *nr_pages); void ceph_readpage_to_fscache(struct inode *inode, struct page *page); void ceph_invalidate_fscache_page(struct inode* inode, struct page *page); static inline void ceph_fscache_inode_init(struct ceph_inode_info *ci) { ci->fscache = NULL; ci->i_fscache_gen = 0; } static inline void ceph_fscache_invalidate(struct inode *inode) { fscache_invalidate(ceph_inode(inode)->fscache); } static inline void ceph_fscache_uncache_page(struct inode *inode, struct page *page) { struct ceph_inode_info *ci = ceph_inode(inode); return fscache_uncache_page(ci->fscache, page); } static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp) { struct inode* inode = page->mapping->host; struct ceph_inode_info *ci = ceph_inode(inode); return fscache_maybe_release_page(ci->fscache, page, gfp); } static inline void ceph_fscache_readpage_cancel(struct inode *inode, struct page *page) { struct ceph_inode_info *ci = ceph_inode(inode); if (fscache_cookie_valid(ci->fscache) && PageFsCache(page)) __fscache_uncache_page(ci->fscache, page); } static inline void ceph_fscache_readpages_cancel(struct inode *inode, struct list_head *pages) { struct ceph_inode_info *ci = ceph_inode(inode); return fscache_readpages_cancel(ci->fscache, pages); } static inline void ceph_disable_fscache_readpage(struct ceph_inode_info *ci) { ci->i_fscache_gen = ci->i_rdcache_gen - 1; } #else static inline int ceph_fscache_register(void) { return 0; } static inline void ceph_fscache_unregister(void) { } static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc) { return 0; } static inline void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc) { } static inline void ceph_fscache_inode_init(struct ceph_inode_info *ci) { } static inline void ceph_fscache_register_inode_cookie(struct inode *inode) { } static inline void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci) { } static inline void ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp) { } static inline void ceph_fscache_revalidate_cookie(struct ceph_inode_info *ci) { } static inline void ceph_fscache_uncache_page(struct inode *inode, struct page *pages) { } static inline int ceph_readpage_from_fscache(struct inode* inode, struct page *page) { return -ENOBUFS; } static inline int ceph_readpages_from_fscache(struct inode *inode, struct address_space *mapping, struct list_head *pages, unsigned *nr_pages) { return -ENOBUFS; } static inline void ceph_readpage_to_fscache(struct inode *inode, struct page *page) { } static inline void ceph_fscache_invalidate(struct inode *inode) { } static inline void ceph_invalidate_fscache_page(struct inode *inode, struct page *page) { } static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp) { return 1; } static inline void ceph_fscache_readpage_cancel(struct inode *inode, struct page *page) { } static inline void ceph_fscache_readpages_cancel(struct inode *inode, struct list_head *pages) { } static inline void ceph_disable_fscache_readpage(struct ceph_inode_info *ci) { } #endif #endif icmpv6 codes properly, from Simon Horman. 5) Initial MAC address can be set incorrectly in some scenerios, from Ivan Vecera. 6) Packet header pointer arithmetic fix in ip6_tnl_parse_tlv_end_lim(), from Dan Carpenter. 7) Fix divide by zero in __tcp_select_window(), from Eric Dumazet. 8) Fix crash in iwlwifi when unregistering thermal zone, from Jens Axboe. 9) Check for DMA mapping errors in starfire driver, from Alexey Khoroshilov. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (31 commits) tcp: fix 0 divide in __tcp_select_window() ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim() net: fix ndo_features_check/ndo_fix_features comment ordering net/sched: matchall: Fix configuration race be2net: fix initial MAC setting ipv6: fix flow labels when the traffic class is non-0 net: thunderx: avoid dereferencing xcv when NULL net/sched: cls_flower: Correct matching on ICMPv6 code ipv6: Paritially checksum full MTU frames net/mlx4_core: Avoid command timeouts during VF driver device shutdown gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page net: ethtool: add support for 2500BaseT and 5000BaseT link modes can: bcm: fix hrtimer/tasklet termination in bcm op removal net: adaptec: starfire: add checks for dma mapping errors net: phy: micrel: KSZ8795 do not set SUPPORTED_[Asym_]Pause can: Fix kernel panic at security_sock_rcv_skb net: macb: Fix 64 bit addressing support for GEM stmmac: Discard masked flags in interrupt status register net/mlx5e: Check ets capability before ets query FW command net/mlx5e: Fix update of hash function/key via ethtool ... 2017-02-01tcp: fix 0 divide in __tcp_select_window()Eric Dumazet1-2/+4 syszkaller fuzzer was able to trigger a divide by zero, when TCP window scaling is not enabled. SO_RCVBUF can be used not only to increase sk_rcvbuf, also to decrease it below current receive buffers utilization. If mss is negative or 0, just return a zero TCP window. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()Dan Carpenter1-1/+1 Casting is a high precedence operation but "off" and "i" are in terms of bytes so we need to have some parenthesis here. Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01net/sched: matchall: Fix configuration raceYotam Gigi1-82/+45 In the current version, the matchall internal state is split into two structs: cls_matchall_head and cls_matchall_filter. This makes little sense, as matchall instance supports only one filter, and there is no situation where one exists and the other does not. In addition, that led to some races when filter was deleted while packet was processed. Unify that two structs into one, thus simplifying the process of matchall creation and deletion. As a result, the new, delete and get callbacks have a dummy implementation where all the work is done in destroy and change callbacks, as was done in cls_cgroup. Fixes: bf3994d2ed31 ("net/sched: introduce Match-all classifier") Reported-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>