| .. | .. |
|---|
| 285 | 285 | if (nbh == NULL) { /* blocksize == pagesize */ |
|---|
| 286 | 286 | xa_erase_irq(&btnc->i_pages, newkey); |
|---|
| 287 | 287 | unlock_page(ctxt->bh->b_page); |
|---|
| 288 | | - } else |
|---|
| 289 | | - brelse(nbh); |
|---|
| 288 | + } else { |
|---|
| 289 | + /* |
|---|
| 290 | + * When canceling a buffer that a prepare operation has |
|---|
| 291 | + * allocated to copy a node block to another location, use |
|---|
| 292 | + * nilfs_btnode_delete() to initialize and release the buffer |
|---|
| 293 | + * so that the buffer flags will not be in an inconsistent |
|---|
| 294 | + * state when it is reallocated. |
|---|
| 295 | + */ |
|---|
| 296 | + nilfs_btnode_delete(nbh); |
|---|
| 297 | + } |
|---|
| 290 | 298 | } |
|---|