Message ID | CABr-GneD2JwJ5YHx9n5C42zeiivF5gg0hcg_mab1EuwucfOp0Q@mail.gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On 05/04/2014 01:34 AM, Christophe Varoqui wrote: > It seems sg_persist is doing an "open rw => close" for --in commands, > causing a kernel change-event. Yep. Look for 'watch' in the udev rules, that's precisely what it's doing. (Bloody annoying if you ask me. Generally I recommend to remove that thing from the rules). Cheers, Hannes
Dne 4.5.2014 18:54, Hannes Reinecke napsal(a): > On 05/04/2014 01:34 AM, Christophe Varoqui wrote: >> It seems sg_persist is doing an "open rw => close" for --in commands, >> causing a kernel change-event. > Yep. > > Look for 'watch' in the udev rules, that's precisely what it's doing. > > (Bloody annoying if you ask me. Generally I recommend to remove that thing > from the rules). When watch rule is disabled/removed in udev rules - your udev db becomes invalid when i.e. you run command like 'mkfs' - since the udev db will not be updated to list information about newly formatted filesystem. Of course there are many cases where disabling watch rule makes sense (i.e. you export lots of disks to virtual guests) - but unless you are familiar with udev and you know what you are doing - think twice before disabling. Zdenek -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
--- sg_persist.c.orig 2014-05-04 01:10:01.987981956 +0200 +++ sg_persist.c 2014-05-04 01:15:34.880008000 +0200 @@ -1029,6 +1029,8 @@ struct sg_simple_inquiry_resp inq_resp; const char * cp; struct opts_t opts; + int omode = 0; + const char *omode_desc = NULL; memset(&opts, 0, sizeof(opts)); opts.prin = 1; @@ -1292,10 +1294,18 @@ sg_cmds_close_device(sg_fd); } - if ((sg_fd = sg_cmds_open_device(device_name, 0 /* rw */, + if (opts.prin) { + omode = 1; + omode_desc = "ro"; + } else { + omode = 0; + omode_desc = "rw"; + } + + if ((sg_fd = sg_cmds_open_device(device_name, omode, opts.verbose)) < 0) { - pr2serr("sg_persist: error opening file (rw): %s: %s\n", device_name, - safe_strerror(-sg_fd)); + pr2serr("sg_persist: error opening file (%s): %s: %s\n", omode_desc, + device_name, safe_strerror(-sg_fd)); return SG_LIB_FILE_ERROR;