From faa1c8d802f8e285e563b330b360cac8f253c44f Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 14 May 2013 13:54:55 +0200 Subject: [PATCH] light: fix attach on locked device --- kernel/sy_old/mars_light.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/sy_old/mars_light.c b/kernel/sy_old/mars_light.c index 5b0eda59..305116d2 100644 --- a/kernel/sy_old/mars_light.c +++ b/kernel/sy_old/mars_light.c @@ -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;