mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 12:46:04 +07:00
7135a71b19
Andy Whitcroft reported an oops in aoe triggered by use of an
incorrectly initialised request_queue object:
[ 2645.959090] kobject '<NULL>' (ffff880059ca22c0): tried to add
an uninitialized object, something is seriously wrong.
[ 2645.959104] Pid: 6, comm: events/0 Not tainted 2.6.31-5-generic #24-Ubuntu
[ 2645.959107] Call Trace:
[ 2645.959139] [<ffffffff8126ca2f>] kobject_add+0x5f/0x70
[ 2645.959151] [<ffffffff8125b4ab>] blk_register_queue+0x8b/0xf0
[ 2645.959155] [<ffffffff8126043f>] add_disk+0x8f/0x160
[ 2645.959161] [<ffffffffa01673c4>] aoeblk_gdalloc+0x164/0x1c0 [aoe]
The request queue of an aoe device is not used but can be allocated in
code that does not sleep.
Bruno bisected this regression down to
cd43e26f07
block: Expose stacked device queues in sysfs
"This seems to generate /sys/block/$device/queue and its contents for
everyone who is using queues, not just for those queues that have a
non-NULL queue->request_fn."
Addresses http://bugs.launchpad.net/bugs/410198
Addresses http://bugzilla.kernel.org/show_bug.cgi?id=13942
Note that embedding a queue inside another object has always been
an illegal construct, since the queues are reference counted and
must persist until the last reference is dropped. So aoe was
always buggy in this respect (Jens).
Signed-off-by: Ed Cashin <ecashin@coraid.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Bruno Premont <bonbons@linux-vserver.org>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
204 lines
4.6 KiB
C
204 lines
4.6 KiB
C
/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */
|
|
#define VERSION "47"
|
|
#define AOE_MAJOR 152
|
|
#define DEVICE_NAME "aoe"
|
|
|
|
/* set AOE_PARTITIONS to 1 to use whole-disks only
|
|
* default is 16, which is 15 partitions plus the whole disk
|
|
*/
|
|
#ifndef AOE_PARTITIONS
|
|
#define AOE_PARTITIONS (16)
|
|
#endif
|
|
|
|
#define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor))
|
|
#define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF)
|
|
#define AOEMINOR(sysminor) ((sysminor) % NPERSHELF)
|
|
#define WHITESPACE " \t\v\f\n"
|
|
|
|
enum {
|
|
AOECMD_ATA,
|
|
AOECMD_CFG,
|
|
AOECMD_VEND_MIN = 0xf0,
|
|
|
|
AOEFL_RSP = (1<<3),
|
|
AOEFL_ERR = (1<<2),
|
|
|
|
AOEAFL_EXT = (1<<6),
|
|
AOEAFL_DEV = (1<<4),
|
|
AOEAFL_ASYNC = (1<<1),
|
|
AOEAFL_WRITE = (1<<0),
|
|
|
|
AOECCMD_READ = 0,
|
|
AOECCMD_TEST,
|
|
AOECCMD_PTEST,
|
|
AOECCMD_SET,
|
|
AOECCMD_FSET,
|
|
|
|
AOE_HVER = 0x10,
|
|
};
|
|
|
|
struct aoe_hdr {
|
|
unsigned char dst[6];
|
|
unsigned char src[6];
|
|
__be16 type;
|
|
unsigned char verfl;
|
|
unsigned char err;
|
|
__be16 major;
|
|
unsigned char minor;
|
|
unsigned char cmd;
|
|
__be32 tag;
|
|
};
|
|
|
|
struct aoe_atahdr {
|
|
unsigned char aflags;
|
|
unsigned char errfeat;
|
|
unsigned char scnt;
|
|
unsigned char cmdstat;
|
|
unsigned char lba0;
|
|
unsigned char lba1;
|
|
unsigned char lba2;
|
|
unsigned char lba3;
|
|
unsigned char lba4;
|
|
unsigned char lba5;
|
|
unsigned char res[2];
|
|
};
|
|
|
|
struct aoe_cfghdr {
|
|
__be16 bufcnt;
|
|
__be16 fwver;
|
|
unsigned char scnt;
|
|
unsigned char aoeccmd;
|
|
unsigned char cslen[2];
|
|
};
|
|
|
|
enum {
|
|
DEVFL_UP = 1, /* device is installed in system and ready for AoE->ATA commands */
|
|
DEVFL_TKILL = (1<<1), /* flag for timer to know when to kill self */
|
|
DEVFL_EXT = (1<<2), /* device accepts lba48 commands */
|
|
DEVFL_CLOSEWAIT = (1<<3), /* device is waiting for all closes to revalidate */
|
|
DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */
|
|
DEVFL_KICKME = (1<<5), /* slow polling network card catch */
|
|
DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
|
|
|
|
BUFFL_FAIL = 1,
|
|
};
|
|
|
|
enum {
|
|
DEFAULTBCNT = 2 * 512, /* 2 sectors */
|
|
NPERSHELF = 16, /* number of slots per shelf address */
|
|
FREETAG = -1,
|
|
MIN_BUFS = 16,
|
|
NTARGETS = 8,
|
|
NAOEIFS = 8,
|
|
NSKBPOOLMAX = 128,
|
|
|
|
TIMERTICK = HZ / 10,
|
|
MINTIMER = HZ >> 2,
|
|
MAXTIMER = HZ << 1,
|
|
HELPWAIT = 20,
|
|
};
|
|
|
|
struct buf {
|
|
struct list_head bufs;
|
|
ulong stime; /* for disk stats */
|
|
ulong flags;
|
|
ulong nframesout;
|
|
ulong resid;
|
|
ulong bv_resid;
|
|
ulong bv_off;
|
|
sector_t sector;
|
|
struct bio *bio;
|
|
struct bio_vec *bv;
|
|
};
|
|
|
|
struct frame {
|
|
int tag;
|
|
ulong waited;
|
|
struct buf *buf;
|
|
char *bufaddr;
|
|
ulong bcnt;
|
|
sector_t lba;
|
|
struct sk_buff *skb;
|
|
};
|
|
|
|
struct aoeif {
|
|
struct net_device *nd;
|
|
unsigned char lost;
|
|
unsigned char lostjumbo;
|
|
ushort maxbcnt;
|
|
};
|
|
|
|
struct aoetgt {
|
|
unsigned char addr[6];
|
|
ushort nframes;
|
|
struct frame *frames;
|
|
struct aoeif ifs[NAOEIFS];
|
|
struct aoeif *ifp; /* current aoeif in use */
|
|
ushort nout;
|
|
ushort maxout;
|
|
u16 lasttag; /* last tag sent */
|
|
u16 useme;
|
|
ulong lastwadj; /* last window adjustment */
|
|
int wpkts, rpkts;
|
|
int dataref;
|
|
};
|
|
|
|
struct aoedev {
|
|
struct aoedev *next;
|
|
ulong sysminor;
|
|
ulong aoemajor;
|
|
u16 aoeminor;
|
|
u16 flags;
|
|
u16 nopen; /* (bd_openers isn't available without sleeping) */
|
|
u16 rttavg; /* round trip average of requests/responses */
|
|
u16 mintimer;
|
|
u16 fw_ver; /* version of blade's firmware */
|
|
struct work_struct work;/* disk create work struct */
|
|
struct gendisk *gd;
|
|
struct request_queue *blkq;
|
|
struct hd_geometry geo;
|
|
sector_t ssize;
|
|
struct timer_list timer;
|
|
spinlock_t lock;
|
|
struct sk_buff_head sendq;
|
|
struct sk_buff_head skbpool;
|
|
mempool_t *bufpool; /* for deadlock-free Buf allocation */
|
|
struct list_head bufq; /* queue of bios to work on */
|
|
struct buf *inprocess; /* the one we're currently working on */
|
|
struct aoetgt *targets[NTARGETS];
|
|
struct aoetgt **tgt; /* target in use when working */
|
|
struct aoetgt **htgt; /* target needing rexmit assistance */
|
|
};
|
|
|
|
|
|
int aoeblk_init(void);
|
|
void aoeblk_exit(void);
|
|
void aoeblk_gdalloc(void *);
|
|
void aoedisk_rm_sysfs(struct aoedev *d);
|
|
|
|
int aoechr_init(void);
|
|
void aoechr_exit(void);
|
|
void aoechr_error(char *);
|
|
|
|
void aoecmd_work(struct aoedev *d);
|
|
void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
|
|
void aoecmd_ata_rsp(struct sk_buff *);
|
|
void aoecmd_cfg_rsp(struct sk_buff *);
|
|
void aoecmd_sleepwork(struct work_struct *);
|
|
void aoecmd_cleanslate(struct aoedev *);
|
|
struct sk_buff *aoecmd_ata_id(struct aoedev *);
|
|
|
|
int aoedev_init(void);
|
|
void aoedev_exit(void);
|
|
struct aoedev *aoedev_by_aoeaddr(int maj, int min);
|
|
struct aoedev *aoedev_by_sysminor_m(ulong sysminor);
|
|
void aoedev_downdev(struct aoedev *d);
|
|
int aoedev_flush(const char __user *str, size_t size);
|
|
|
|
int aoenet_init(void);
|
|
void aoenet_exit(void);
|
|
void aoenet_xmit(struct sk_buff_head *);
|
|
int is_aoe_netif(struct net_device *ifp);
|
|
int set_aoe_iflist(const char __user *str, size_t size);
|
|
|