Skip to contentSkip to conversation

resend patch - bcache may mistakenly write data to another disk when writes error

linux-lvm David Teigland 1 participant 2 messages Nov 12, 2019 – Nov 13, 2019 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Heming Zhao

There still have bug codes wait for fixing.
Please see below item <2>. the _last_byte_xx (in bcache.c) should be restored to ZERO when fail/error. Do you have any plan/schedule to this issue?
Do you have any plan/schedule to backport these fixes to stable-2.02 branch?

I don't think it should actually be a problem since bcache_unset_last_byte checks for _last_byte_fd == fd. But, I think it's better to not rely on that check, so how about a change like this?

void dev_unset_last_byte(struct device *dev)

{
        if (dev->bcache_fd > 0)
                bcache_unset_last_byte(scan_bcache, dev->bcache_fd);
}

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 10 lines · Heming Zhao

label_write // @ lib/label/label.c

  +-> dev_write_bytes //
  |    +-> if (!bcache_flush()) //when failed, call below invalidate
  |          label_scan_invalidate // will set fd=-1 in _scan_dev_close()
  +-> dev_unset_last_byte // with fd: -1
      +-> bcache_unset_last_byte
            +-> _last_byte_fd != fd(-1), the _last_byte_xx never clean.

```
So all bcache_unset_last_byte which after dev_write_bytes should be modified. For detail code fix, please check my V2 patch which I sent on Oct 28th.

Got it, thanks for your work on that, please check I got all the necessary lines from your patch.

https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=13c254fc05386d05ab6bbda2806f9ca4d3358a0c

Quoted 1 line

Would you have any plan/schedule to backport bcache bug fixes to stable-2.02 branch?

I'll try to apply them all today.