mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
rbd: make 'add' modprobe rbd so it has a chance of success
Check for existence of /sys/bus/rbd first to avoid unnecessary calls Fixes: #3784 Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
This commit is contained in:
parent
15bb00cafc
commit
e94b06a192
@ -1194,6 +1194,11 @@ static int do_kernel_add(const char *poolname, const char *imgname, const char *
|
||||
oss << " " << snapname;
|
||||
}
|
||||
|
||||
// modprobe the rbd module if /sys/bus/rbd doesn't exist
|
||||
struct stat sb;
|
||||
if ((stat("/sys/bus/rbd", &sb) < 0) || (!S_ISDIR(sb.st_mode)))
|
||||
system("/sbin/modprobe rbd");
|
||||
|
||||
// write to /sys/bus/rbd/add
|
||||
int fd = open("/sys/bus/rbd/add", O_WRONLY);
|
||||
if (fd < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user