Skip to contentSkip to conversation

(2/11) various minor cleanups

PATCH New Petr Rockai 3 participants 3 messages Oct 30, 2008 – Nov 5, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (2/11) various minor cleanups

Hi,

just un-interesting minor changes that have happened while working on lvmlib.

Yours,
Petr.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-lvmlib-various.diff
Type: text/x-diff
Size: 1906 bytes
Desc: lvmlib-various.diff
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20081030/2eabad38/attachment.bin>
-------------- next part --------------

Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation
#1 lore raw

PATCH 1/1 (2/11) various minor cleanups

Quoted 8 lines · Petr Rockai

diff -rN -p -u old-lvmlib-b/lib/device/dev-io.c
new-lvmlib-b/lib/device/dev-io.c
--- old-lvmlib-b/lib/device/dev-io.c 2008-10-30 17:43:21.097833255
+0100
+++ new-lvmlib-b/lib/device/dev-io.c 2008-10-30 17:43:21.161836711
+0100

(quoted diff) +0 -0
@@ -622,6 +622,11 @@ int dev_write(struct device *dev, uint64
        where.start = offset;

Review int dev_write(struct device *dev, uint64 · line 632

Quoted 10 lines
(quoted diff) +5 -0
        where.size = len;
 
+       if (!vg_write_lock_held()) {
+               log_error("Attempted to write unlocked VG's device.");
+               return_0;
+       }
+
        dev->flags |= DEV_ACCESSED_W;
 
 

This looks a little strange here but as far as I can tell this is a reasonable check. The only command I could think of that might write to a device without a write VG lock would be vgcfgbackup, but this actually uses its own IO path (not dev_write()).

Probably want a WHATS_NEW comment like:
Do not allow dev_write() to proceed unless a VG write lock is held.

#2 lore raw

PATCH 1/1 (2/11) various minor cleanups

Quoted 5 lines · Dave Wysochanski
Quoted 1 line · Petr Rockai

+ log_error("Attempted to write unlocked VG's device.");

Probably want a WHATS_NEW comment like:
Do not allow dev_write() to proceed unless a VG write lock is held.

And make the error message useful by including specific details in it:-)

Alasdair

Signature · 1 line
agk at redhat.com