/* * netsniff-ng - the packet sniffing beast * Copyright 2009 - 2013 Daniel Borkmann. * Subject to the GPL, version 2. */ #ifndef DISSECTOR_H #define DISSECTOR_H #include #include #include #include "ring.h" #include "tprintf.h" #include "pcap_io.h" #include "built_in.h" #define PRINT_NORM 0 #define PRINT_LESS 1 #define PRINT_HEX 2 #define PRINT_ASCII 3 #define PRINT_HEX_ASCII 4 #define PRINT_NONE 5 static const char * const packet_types[256]={ "<", /* Incoming */ "B", /* Broadcast */ "M", /* Multicast */ "P", /* Promisc */ ">", /* Outgoing */ "?", /* Unknown */ }; extern char *if_indextoname(unsigned ifindex, char *ifname); static inline const char *__show_ts_source(uint32_t status) { if (status & TP_STATUS_TS_RAW_HARDWARE) return "(raw hw ts)"; else if (status & TP_STATUS_TS_SYS_HARDWARE) return "(sys hw ts)"; else if (status & TP_STATUS_TS_SOFTWARE) return "(sw ts)"; else return ""; } static inline void __show_frame_hdr(struct sockaddr_ll *s_ll, void *raw, int mode, bool v3) { char tmp[IFNAMSIZ]; union tpacket_uhdr hdr; if (mode == PRINT_NONE) return; hdr.raw = raw; switch (mode) { case PRINT_LESS: tprintf("%s %s %u", packet_types[s_ll->sll_pkttype] ? : "?", if_indextoname(s_ll->sll_ifindex, tmp) ? : "?", v3 ? hdr.h3->tp_len : hdr.h2->tp_len); break; default: tprintf("%s %s %u %us.%uns %s\n", packet_types[s_ll->sll_pkttype] ? : "?", if_indextoname(s_ll->sll_ifindex, tmp) ? : "?", v3 ? hdr.h3->tp_len : hdr.h2->tp_len, v3 ? hdr.h3->tp_sec : hdr.h2->tp_sec, v3 ? hdr.h3->tp_nsec : hdr.h2->tp_nsec, v3 ? "" : __show_ts_source(hdr.h2->tp_status)); break; } } static inline void show_frame_hdr(struct frame_map *hdr, int mode) { __show_frame_hdr(&hdr->s_ll, &hdr->tp_h, mode, false); } extern void dissector_init_all(int fnttype); extern void dissector_entry_point(uint8_t *packet, size_t len, int linktype, int mode); extern void dissector_cleanup_all(void); extern int dissector_set_print_type(void *ptr, int type); #endif /* DISSECTOR_H */ git/diff/?h=nds-private-remove&id=0596a9048bf2aca2a74b312493f39e4d5ac3b653'>diff
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2016-06-14 14:18:27 +0100
committerFilipe Manana <fdmanana@suse.com>2016-08-01 07:21:13 +0100
commit0596a9048bf2aca2a74b312493f39e4d5ac3b653 (patch)
treeed34df6a3fe3d67d749594f4e9de0fe9c720ab17
parent8b8b08cbfb9021af4b54b4175fc4c51d655aac8c (diff)
Btrfs: add missing check for writeback errors on fsync
When we start an fsync we start ordered extents for all delalloc ranges. However before attempting to log the inode, we only wait for those ordered extents if we are not doing a full sync (bit BTRFS_INODE_NEEDS_FULL_SYNC is set in the inode's flags). This means that if an ordered extent completes with an IO error before we check if we can skip logging the inode, we will not catch and report the IO error to user space. This is because on an IO error, when the ordered extent completes we do not update the inode, so if the inode was not previously updated by the current transaction we end up not logging it through calls to fsync and therefore not check its mapping flags for the presence of IO errors. Fix this by checking for errors in the flags of the inode's mapping when we notice we can skip logging the inode. This caused sporadic failures in the test generic/331 (which explicitly tests for IO errors during an fsync call). Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com>