public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: pcaulfield@sourceware.org To: lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-command.c ... Date: Thu, 05 Oct 2006 13:55:00 -0000 [thread overview] Message-ID: <20061005135551.28190.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: pcaulfield@sourceware.org 2006-10-05 13:55:50 Modified files: . : WHATS_NEW daemons/clvmd : clvmd-command.c clvmd.c lvm-functions.c lvm-functions.h Log message: Vastly improve the errors returned to the user from clvmd. It now captures the error messages that are generated and returns them in the reply packet rather than just telling the user to check syslog. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.451&r2=1.452 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4 --- LVM2/WHATS_NEW 2006/10/04 16:03:17 1.451 +++ LVM2/WHATS_NEW 2006/10/05 13:55:50 1.452 @@ -1,5 +1,6 @@ Version 2.02.11 - ===================================== + Capture error messages in clvmd and pass them back to the user. Remove unused #defines from filter-md.c. Make clvmd restart init script wait until clvmd has died before starting it. Add -R to clvmd which tells running clvmds to reload their device cache. --- LVM2/daemons/clvmd/clvmd-command.c 2006/10/04 08:22:16 1.9 +++ LVM2/daemons/clvmd/clvmd-command.c 2006/10/05 13:55:50 1.10 @@ -117,7 +117,7 @@ if (status == EIO) { *retlen = 1 + snprintf(*buf, buflen, - "Internal lvm error, check syslog"); + get_last_lvm_error()); return EIO; } break; --- LVM2/daemons/clvmd/clvmd.c 2006/10/04 08:22:16 1.27 +++ LVM2/daemons/clvmd/clvmd.c 2006/10/05 13:55:50 1.28 @@ -1689,6 +1689,7 @@ } pthread_mutex_unlock(&lvm_thread_mutex); } + return NULL; } /* Pass down some work to the LVM thread */ --- LVM2/daemons/clvmd/lvm-functions.c 2006/10/04 08:22:16 1.22 +++ LVM2/daemons/clvmd/lvm-functions.c 2006/10/05 13:55:50 1.23 @@ -50,12 +50,18 @@ static struct cmd_context *cmd = NULL; static struct dm_hash_table *lv_hash = NULL; static pthread_mutex_t lv_hash_lock; +static char last_error[1024]; struct lv_info { int lock_id; int lock_mode; }; +char *get_last_lvm_error() +{ + return last_error; +} + /* Return the mode a lock is currently held at (or -1 if not held) */ static int get_current_lock(char *resource) { @@ -201,8 +207,17 @@ /* Try to get the lock if it's a clustered volume group */ if (lock_flags & LCK_CLUSTER_VG) { status = hold_lock(resource, mode, LKF_NOQUEUE); - if (status) + if (status) { + /* Return an LVM-sensible error for this. + * Forcing EIO makes the upper level return this text + * rather than the strerror text for EAGAIN. + */ + if (errno == EAGAIN) { + sprintf(last_error, "Volume is busy on another node"); + errno = EIO; + } return errno; + } } /* If it's suspended then resume it */ @@ -512,6 +527,19 @@ return NULL; } +static void lvm2_log_fn(int level, const char *file, int line, + const char *message) +{ + /* + * Ignore non-error messages, but store the latest one for returning + * to the user. + */ + if (level != _LOG_ERR && level != _LOG_FATAL) + return; + + strcpy(last_error, message); +} + /* This checks some basic cluster-LVM configuration stuff */ static void check_config() { @@ -564,5 +592,8 @@ get_initial_state(); + /* Trap log messages so we can pass them back to the user */ + init_log_fn(lvm2_log_fn); + return 1; } --- LVM2/daemons/clvmd/lvm-functions.h 2006/10/04 08:22:16 1.3 +++ LVM2/daemons/clvmd/lvm-functions.h 2006/10/05 13:55:50 1.4 @@ -32,5 +32,6 @@ extern int hold_unlock(char *resource); extern int hold_lock(char *resource, int mode, int flags); extern void unlock_all(void); +extern char *get_last_lvm_error(void); #endif
next reply other threads:[~2006-10-05 13:55 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-10-05 13:55 pcaulfield [this message] -- strict thread matches above, loose matches on Subject: below -- 2011-09-26 7:51 zkabelac 2011-06-01 21:16 agk 2011-04-08 14:40 zkabelac 2011-02-18 16:18 zkabelac 2011-02-04 19:18 zkabelac 2011-01-31 19:52 zkabelac 2011-01-17 23:13 mbroz 2011-01-10 14:02 zkabelac 2010-06-17 12:48 mbroz 2010-06-04 12:59 mbroz 2010-01-05 16:07 mbroz 2010-01-05 16:05 mbroz 2009-12-09 18:42 mbroz 2009-04-22 9:40 mbroz 2008-05-09 18:45 agk 2008-05-09 15:13 agk 2008-04-15 14:46 mbroz 2008-04-15 11:36 agk 2006-12-11 14:00 pcaulfield 2006-05-12 19:16 agk 2005-10-16 23:04 agk 2005-08-16 8:25 pcaulfield
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20061005135551.28190.qmail@sourceware.org \ --to=pcaulfield@sourceware.org \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).