From: Andi Kleen <andi@firstfloor.org>
To: Artem.Bityutskiy@nokia.com, gregkh@suse.de, ak@linux.intel.com,
linux-kernel@vger.kernel.org, stable@kernel.org,
tim.bird@am.sony.com
Subject: [PATCH] [19/106] UBIFS: fix debugging failure in dbg_check_space_info
Date: Tue, 26 Apr 2011 14:12:57 -0700 (PDT) [thread overview]
Message-ID: <20110426211257.B95193E1886@tassilo.jf.intel.com> (raw)
In-Reply-To: <20110426212.641772347@firstfloor.org>
2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
commit 7da6443aca9be29c6948dcbd636ad50154d0bc0c upstream.
This patch fixes a debugging failure with which looks like this:
UBIFS error (pid 32313): dbg_check_space_info: free space changed from 6019344 to 6022654
The reason for this failure is described in the comment this patch adds
to the code. But in short - 'c->freeable_cnt' may be different before
and after re-mounting, and this is normal. So the debugging code should
make sure that free space calculations do not depend on 'c->freeable_cnt'.
A similar issue has been reported here:
http://lists.infradead.org/pipermail/linux-mtd/2011-April/034647.html
This patch should fix it.
For the -stable guys: this patch is only relevant for kernels 2.6.30
onwards.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
fs/ubifs/debug.c | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
Index: linux-2.6.35.y/fs/ubifs/debug.c
===================================================================
--- linux-2.6.35.y.orig/fs/ubifs/debug.c
+++ linux-2.6.35.y/fs/ubifs/debug.c
@@ -961,11 +961,39 @@ void dbg_dump_index(struct ubifs_info *c
void dbg_save_space_info(struct ubifs_info *c)
{
struct ubifs_debug_info *d = c->dbg;
-
- ubifs_get_lp_stats(c, &d->saved_lst);
+ int freeable_cnt;
spin_lock(&c->space_lock);
+ memcpy(&d->saved_lst, &c->lst, sizeof(struct ubifs_lp_stats));
+
+ /*
+ * We use a dirty hack here and zero out @c->freeable_cnt, because it
+ * affects the free space calculations, and UBIFS might not know about
+ * all freeable eraseblocks. Indeed, we know about freeable eraseblocks
+ * only when we read their lprops, and we do this only lazily, upon the
+ * need. So at any given point of time @c->freeable_cnt might be not
+ * exactly accurate.
+ *
+ * Just one example about the issue we hit when we did not zero
+ * @c->freeable_cnt.
+ * 1. The file-system is mounted R/O, c->freeable_cnt is %0. We save the
+ * amount of free space in @d->saved_free
+ * 2. We re-mount R/W, which makes UBIFS to read the "lsave"
+ * information from flash, where we cache LEBs from various
+ * categories ('ubifs_remount_fs()' -> 'ubifs_lpt_init()'
+ * -> 'lpt_init_wr()' -> 'read_lsave()' -> 'ubifs_lpt_lookup()'
+ * -> 'ubifs_get_pnode()' -> 'update_cats()'
+ * -> 'ubifs_add_to_cat()').
+ * 3. Lsave contains a freeable eraseblock, and @c->freeable_cnt
+ * becomes %1.
+ * 4. We calculate the amount of free space when the re-mount is
+ * finished in 'dbg_check_space_info()' and it does not match
+ * @d->saved_free.
+ */
+ freeable_cnt = c->freeable_cnt;
+ c->freeable_cnt = 0;
d->saved_free = ubifs_get_free_space_nolock(c);
+ c->freeable_cnt = freeable_cnt;
spin_unlock(&c->space_lock);
}
@@ -982,12 +1010,15 @@ int dbg_check_space_info(struct ubifs_in
{
struct ubifs_debug_info *d = c->dbg;
struct ubifs_lp_stats lst;
- long long avail, free;
+ long long free;
+ int freeable_cnt;
spin_lock(&c->space_lock);
- avail = ubifs_calc_available(c, c->min_idx_lebs);
+ freeable_cnt = c->freeable_cnt;
+ c->freeable_cnt = 0;
+ free = ubifs_get_free_space_nolock(c);
+ c->freeable_cnt = freeable_cnt;
spin_unlock(&c->space_lock);
- free = ubifs_get_free_space(c);
if (free != d->saved_free) {
ubifs_err("free space changed from %lld to %lld",
next prev parent reply other threads:[~2011-04-26 21:38 UTC|newest]
Thread overview: 125+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-26 21:12 [PATCH] [0/106] 2.6.35.13 longterm review Andi Kleen
2011-04-26 21:12 ` [PATCH] [1/106] mm: page allocator: adjust the per-cpu counter threshold when memory is low Andi Kleen
2011-04-26 21:12 ` [PATCH] [2/106] qla2xxx: Make the FC port capability mutual exclusive Andi Kleen
2011-04-26 21:12 ` [PATCH] [3/106] staging: usbip: bugfixes related to kthread conversion Andi Kleen
2011-04-26 21:12 ` [PATCH] [4/106] staging: usbip: bugfix add number of packets for isochronous frames Andi Kleen
2011-04-26 21:12 ` [PATCH] [5/106] staging: usbip: bugfix for isochronous packets and optimization Andi Kleen
2011-04-26 21:12 ` [PATCH] [6/106] staging: hv: Fix GARP not sent after Quick Migration Andi Kleen
2011-04-26 21:12 ` [PATCH] [7/106] staging: hv: use sync_bitops when interacting with the hypervisor Andi Kleen
2011-04-26 21:12 ` [PATCH] [8/106] xfs: prevent leaking uninitialized stack memory in FSGEOMETRY_V1 Andi Kleen
2011-04-27 5:26 ` Dave Chinner
2011-04-27 15:00 ` Andi Kleen
2011-04-28 0:04 ` Dave Chinner
2011-04-26 21:12 ` [PATCH] [9/106] irda: validate peer name and attribute lengths Andi Kleen
2011-04-26 21:12 ` [PATCH] [10/106] irda: prevent heap corruption on invalid nickname Andi Kleen
2011-04-26 21:12 ` [PATCH] [11/106] nilfs2: fix data loss in mmap page write for hole blocks Andi Kleen
2011-04-26 21:12 ` [PATCH] [12/106] ASoC: Explicitly say registerless widgets have no register Andi Kleen
2011-04-26 21:12 ` [PATCH] [13/106] ALSA: ens1371: fix Creative Ectiva support Andi Kleen
2011-04-26 21:12 ` [PATCH] [14/106] ROSE: prevent heap corruption with bad facilities Andi Kleen
2011-04-26 21:12 ` [PATCH] [15/106] Btrfs: Fix uninitialized root flags for subvolumes Andi Kleen
2011-04-26 21:12 ` [PATCH] [16/106] x86, mtrr, pat: Fix one cpu getting out of sync during resume Andi Kleen
2011-04-26 21:12 ` [PATCH] [17/106] UBIFS: do not read flash unnecessarily Andi Kleen
2011-04-26 21:12 ` [PATCH] [18/106] UBIFS: fix oops on error path in read_pnode Andi Kleen
2011-04-26 21:12 ` Andi Kleen [this message]
2011-04-26 21:12 ` [PATCH] [20/106] quota: Don't write quota info in dquot_commit() Andi Kleen
2011-04-26 21:12 ` [PATCH] [21/106] mm: avoid wrapping vm_pgoff in mremap() Andi Kleen
2011-04-26 21:13 ` [PATCH] [22/106] p54usb: IDs for two new devices Andi Kleen
2011-04-26 21:13 ` [PATCH] [23/106] b43: allocate receive buffers big enough for max frame len + offset Andi Kleen
2011-04-26 21:13 ` [PATCH] [24/106] Bluetooth: sco: fix information leak to userspace Andi Kleen
2011-04-26 21:13 ` [PATCH] [25/106] bridge: netfilter: fix information leak Andi Kleen
2011-04-26 21:13 ` [PATCH] [26/106] Bluetooth: bnep: fix buffer overflow Andi Kleen
2011-04-26 21:13 ` [PATCH] [27/106] Bluetooth: add support for Apple MacBook Pro 8,2 Andi Kleen
2011-04-26 21:13 ` [PATCH] [28/106] Treat writes as new when holes span across page boundaries Andi Kleen
2011-04-26 21:13 ` [PATCH] [29/106] char/tpm: Fix unitialized usage of data buffer Andi Kleen
2011-04-26 21:13 ` [PATCH] [30/106] netfilter: ip_tables: fix infoleak to userspace Andi Kleen
2011-04-26 21:13 ` [PATCH] [31/106] netfilter: arp_tables: " Andi Kleen
2011-04-26 21:13 ` [PATCH] [32/106] netfilter: ipt_CLUSTERIP: fix buffer overflow Andi Kleen
2011-04-26 21:13 ` [PATCH] [33/106] ipv6: netfilter: ip6_tables: fix infoleak to userspace Andi Kleen
2011-04-26 21:13 ` [PATCH] [34/106] mfd: ab3100: world-writable debugfs *_priv files Andi Kleen
2011-04-26 21:13 ` [PATCH] [35/106] drivers/rtc/rtc-ds1511.c: world-writable sysfs nvram file Andi Kleen
2011-04-26 21:13 ` [PATCH] [36/106] drivers/misc/ep93xx_pwm.c: world-writable sysfs files Andi Kleen
2011-04-26 21:13 ` [PATCH] [37/106] econet: 4 byte infoleak to the network Andi Kleen
2011-04-26 21:13 ` [PATCH] [38/106] sound/oss: remove offset from load_patch callbacks Andi Kleen
2011-04-26 21:13 ` [PATCH] [39/106] sound: oss: midi_synth: check get_user() return value Andi Kleen
2011-04-26 21:13 ` [PATCH] [40/106] gro: Reset dev pointer on reuse Andi Kleen
2011-04-26 21:13 ` [PATCH] [41/106] gro: reset skb_iif " Andi Kleen
2011-04-26 21:13 ` [PATCH] [42/106] x86, microcode, AMD: Extend ucode size verification Andi Kleen
2011-04-26 22:44 ` Paul Gortmaker
2011-04-26 23:03 ` Andi Kleen
2011-04-26 21:13 ` [PATCH] [43/106] Squashfs: handle corruption of directory structure Andi Kleen
2011-04-26 21:13 ` [PATCH] [44/106] atm/solos-pci: Don't include frame pseudo-header on transmit hex-dump Andi Kleen
2011-04-26 21:13 ` [PATCH] [45/106] ext4: fix credits computing for indirect mapped files Andi Kleen
2011-04-26 21:13 ` [PATCH] [46/106] nfsd: fix auth_domain reference leak on nlm operations Andi Kleen
2011-04-26 21:13 ` [PATCH] [47/106] net: tipc: fix information leak to userland Andi Kleen
2011-04-26 21:13 ` [PATCH] [48/106] inet_diag: Make sure we actually run the same bytecode we audited Andi Kleen
2011-04-26 21:13 ` [PATCH] [49/106] irda: prevent integer underflow in IRLMP_ENUMDEVICES Andi Kleen
2011-04-26 21:13 ` [PATCH] [50/106] CAN: Use inode instead of kernel address for /proc file Andi Kleen
2011-04-26 21:13 ` [PATCH] [51/106] net: fix rds_iovec page count overflow Andi Kleen
2011-04-26 21:13 ` [PATCH] [52/106] xfs: zero proper structure size for geometry calls Andi Kleen
2011-04-26 21:13 ` [PATCH] [53/106] cifs: always do is_path_accessible check in cifs_mount Andi Kleen
2011-04-26 21:13 ` [PATCH] [54/106] video: sn9c102: world-wirtable sysfs files Andi Kleen
2011-04-26 21:13 ` [PATCH] [55/106] UBIFS: restrict world-writable debugfs files Andi Kleen
2011-04-26 21:13 ` [PATCH] [56/106] NET: cdc-phonet, handle empty phonet header Andi Kleen
2011-04-26 21:13 ` [PATCH] [57/106] x86: Fix a bogus unwind annotation in lib/semaphore_32.S Andi Kleen
2011-04-26 21:13 ` [PATCH] [58/106] tioca: Fix assignment from incompatible pointer warnings Andi Kleen
2011-04-26 21:13 ` [PATCH] [59/106] mca.c: Fix cast from integer to pointer warning Andi Kleen
2011-04-26 21:13 ` [PATCH] [60/106] ramfs: fix memleak on no-mmu arch Andi Kleen
2011-04-26 21:13 ` [PATCH] [61/106] MAINTAINERS: update STABLE BRANCH info Andi Kleen
2011-04-26 21:13 ` [PATCH] [62/106] UBIFS: fix oops when R/O file-system is fsync'ed Andi Kleen
2011-04-26 21:13 ` [PATCH] [63/106] x86, cpu: AMD errata checking framework Andi Kleen
2011-04-26 21:13 ` [PATCH] [64/106] x86, cpu: Clean up AMD erratum 400 workaround Andi Kleen
2011-04-26 21:13 ` [PATCH] [65/106] x86, AMD: Set ARAT feature on AMD processors Andi Kleen
2011-04-26 21:13 ` [PATCH] [66/106] x86, amd: Disable GartTlbWlkErr when BIOS forgets it Andi Kleen
2011-04-26 21:13 ` [PATCH] [67/106] USB: ftdi_sio: Added IDs for CTI USB Serial Devices Andi Kleen
2011-04-26 21:13 ` [PATCH] [68/106] USB: ftdi_sio: add PID for OCT DK201 docking station Andi Kleen
2011-04-26 21:13 ` [PATCH] [69/106] USB: ftdi_sio: add ids for Hameg HO720 and HO730 Andi Kleen
2011-04-26 21:13 ` [PATCH] [70/106] USB: option: Add new ONDA vendor id and product id for ONDA MT825UP Andi Kleen
2011-04-26 21:13 ` [PATCH] [71/106] USB: option: Added support for Samsung GT-B3730/GT-B3710 LTE USB modem Andi Kleen
2011-04-26 21:13 ` [PATCH] [72/106] next_pidmap: fix overflow condition Andi Kleen
2011-04-26 21:13 ` [PATCH] [73/106] proc: do proper range check on readdir offset Andi Kleen
2011-04-26 21:13 ` [PATCH] [74/106] USB: EHCI: unlink unused QHs when the controller is stopped Andi Kleen
2011-04-26 21:13 ` [PATCH] [75/106] USB: fix formatting of SuperSpeed endpoints in /proc/bus/usb/devices Andi Kleen
2011-04-26 21:13 ` [PATCH] [76/106] USB: xhci - fix unsafe macro definitions Andi Kleen
2011-04-26 21:13 ` [PATCH] [77/106] USB: xhci - fix math in xhci_get_endpoint_interval() Andi Kleen
2011-04-26 21:13 ` [PATCH] [78/106] x86, cpu: Fix regression in AMD errata checking code Andi Kleen
2011-04-26 21:14 ` [PATCH] [79/106] net: ax25: fix information leak to userland harder Andi Kleen
2011-04-26 21:14 ` [PATCH] [80/106] Input: synaptics - fix crash in synaptics_module_init() Andi Kleen
2011-04-26 21:14 ` [PATCH] [81/106] ath9k: fix a chip wakeup related crash in ath9k_start Andi Kleen
2011-04-26 21:14 ` [PATCH] [82/106] ath: add missing regdomain pair 0x5c mapping Andi Kleen
2011-04-26 21:14 ` [PATCH] [83/106] block, blk-sysfs: Fix an err return path in blk_register_queue() Andi Kleen
2011-04-26 21:14 ` [PATCH] [84/106] p54: Initialize extra_len in p54_tx_80211 Andi Kleen
2011-04-26 21:14 ` [PATCH] [85/106] x86, gart: Make sure GART does not map physmem above 1TB Andi Kleen
2011-04-26 21:14 ` [PATCH] [86/106] intel-iommu: Unlink domain from iommu Andi Kleen
2011-04-26 21:14 ` [PATCH] [87/106] intel-iommu: Fix get_domain_for_dev() error path Andi Kleen
2011-04-26 21:14 ` [PATCH] [88/106] drm/radeon/kms: fix bad shift in atom iio table parser Andi Kleen
2011-04-26 21:14 ` [PATCH] [89/106] NFS: nfs_wcc_update_inode() should set nfsi->attr_gencount Andi Kleen
2011-04-26 21:14 ` [PATCH] [90/106] serial/imx: read cts state only after acking cts change irq Andi Kleen
2011-04-26 21:14 ` [PATCH] [91/106] ASoC: Fix output PGA enabling in wm_hubs CODECs Andi Kleen
2011-04-26 21:14 ` [PATCH] [92/106] kconfig: Avoid buffer underrun in choice input Andi Kleen
2011-04-26 21:14 ` [PATCH] [93/106] UBIFS: fix master node recovery Andi Kleen
2011-04-26 21:14 ` [PATCH] [94/106] Remove extra struct page member from the buffer info structure Andi Kleen
2011-04-26 21:14 ` [PATCH] [95/106] dasd: correct device table Andi Kleen
2011-04-26 21:14 ` [PATCH] [96/106] iwlagn: Support new 5000 microcode Andi Kleen
2011-04-27 17:42 ` Tim Gardner
2011-04-27 20:47 ` Valdis.Kletnieks
2011-04-27 22:20 ` Andi Kleen
2011-04-27 22:32 ` wwguy
2011-04-27 22:41 ` Andi Kleen
2011-04-27 22:42 ` wwguy
2011-04-27 22:46 ` Andi Kleen
2011-04-28 2:42 ` Tim Gardner
2011-04-26 21:14 ` [PATCH] [97/106] uvcvideo: Fix descriptor parsing for video output devices Andi Kleen
2011-04-26 21:14 ` [PATCH] [98/106] Revert "intel_idle: PCI quirk to prevent Lenovo Ideapad s10-3 boot hang" Andi Kleen
2011-04-26 21:14 ` [PATCH] [99/106] ALSA: hda - VIA: Add missing support for VT1718S in A-A path Andi Kleen
2011-04-26 21:14 ` [PATCH] [100/106] ALSA: hda - VIA: Fix stereo mixer recording no sound issue Andi Kleen
2011-04-26 21:14 ` [PATCH] [101/106] From: iwlwifi: fix skb usage after free Andi Kleen
2011-04-26 21:14 ` [PATCH] [102/106] From: intel-iommu: Fix use after release during device attach Andi Kleen
2011-04-26 21:14 ` [PATCH] [103/106] From: USB: Fix unplug of device with active streams Andi Kleen
2011-04-26 21:14 ` [PATCH] [104/106] From: USB: xhci - also free streams when resetting devices Andi Kleen
2011-04-26 21:14 ` [PATCH] [105/106] From: 2.6.35.y: Revert "SH: Add missing consts to sys_execve() declaration" Andi Kleen
2011-04-26 21:14 ` [PATCH] [106/106] Release 2.6.35.13 Andi Kleen
2011-04-27 0:08 ` [stable] [PATCH] [0/106] 2.6.35.13 longterm review Chuck Ebbert
2011-04-27 2:58 ` Andi Kleen
2011-04-27 0:17 ` Tim Bird
2011-04-27 0:21 ` [stable] " Chuck Ebbert
2011-04-27 3:08 ` Andi Kleen
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=20110426211257.B95193E1886@tassilo.jf.intel.com \
--to=andi@firstfloor.org \
--cc=Artem.Bityutskiy@nokia.com \
--cc=ak@linux.intel.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
--cc=tim.bird@am.sony.com \
/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: link
Be 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
all inboxes | Powered by JetHome®