light: fix attach on locked device

This commit is contained in:
Thomas Schoebel-Theuer 2013-05-14 13:54:55 +02:00
parent ea286c6da1
commit faa1c8d802

View File

@ -231,6 +231,7 @@ struct mars_rotate {
struct mars_global *global;
struct copy_brick *sync_brick;
struct mars_dent *replay_link;
struct mars_brick *bio_brick;
struct mars_dent *aio_dent;
struct aio_brick *aio_brick;
struct mars_info aio_info;
@ -2083,6 +2084,7 @@ int make_log_init(void *buf, struct mars_dent *dent)
{
struct mars_global *global = buf;
struct mars_dent *parent = dent->d_parent;
struct mars_brick *bio_brick;
struct mars_brick *aio_brick;
struct mars_brick *trans_brick;
struct mars_rotate *rot = parent->d_private;
@ -2233,6 +2235,10 @@ int make_log_init(void *buf, struct mars_dent *dent)
if (unlikely(!aio_brick || !aio_brick->power.led_on)) {
goto done; // this may happen in case of detach
}
bio_brick = rot->bio_brick;
if (unlikely(!bio_brick || !bio_brick->power.led_on)) {
goto done; // this may happen in case of detach
}
/* Fetch the actual logfile size
*/
@ -3055,6 +3061,7 @@ static
int make_bio(void *buf, struct mars_dent *dent)
{
struct mars_global *global = buf;
struct mars_rotate *rot;
struct mars_brick *brick;
bool switch_on;
int status = 0;
@ -3062,6 +3069,9 @@ int make_bio(void *buf, struct mars_dent *dent)
if (!global || !global->global_power.button || !dent->d_parent) {
goto done;
}
rot = dent->d_parent->d_private;
if (!rot)
goto done;
switch_on = _check_allow(global, dent->d_parent, "attach");
@ -3077,6 +3087,7 @@ int make_bio(void *buf, struct mars_dent *dent)
dent->d_path,
(const char *[]){},
0);
rot->bio_brick = brick;
if (unlikely(!brick)) {
status = -ENXIO;
goto done;