From: Greg Kroah-Hartman Date: Mon, 19 Nov 2012 23:51:13 +0000 (-0800) Subject: 3.4-stable patches X-Git-Tag: v3.0.53~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=065a221625189ea9b596bca308e8a19fa3afd1c2;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: alsa-hda-add-a-missing-quirk-entry-for-imac-9-1.patch alsa-hda-add-new-codec-alc668-and-alc900-default-name-alc1150.patch alsa-hda-cirrus-fix-coefficient-index-for-beep-configuration.patch alsa-hda-fix-digital-microphone-on-cs420x.patch alsa-hda-fix-empty-dac-filling-in-patch_via.c.patch alsa-hda-fix-invalid-connections-in-vt1802-codec.patch alsa-hda-force-to-reset-iec958-status-bits-for-ad-codecs.patch asoc-dapm-use-card_list-during-dapm-shutdown.patch asoc-wm8978-pll-incorrectly-configured-when-codec-is-master.patch ptp-update-adjfreq-callback-description.patch ubifs-fix-mounting-problems-after-power-cuts.patch ubifs-introduce-categorized-lprops-counter.patch --- diff --git a/queue-3.4/alsa-hda-add-a-missing-quirk-entry-for-imac-9-1.patch b/queue-3.4/alsa-hda-add-a-missing-quirk-entry-for-imac-9-1.patch new file mode 100644 index 00000000000..e3319bd4106 --- /dev/null +++ b/queue-3.4/alsa-hda-add-a-missing-quirk-entry-for-imac-9-1.patch @@ -0,0 +1,29 @@ +From 05193639ca977cc889668718adb38db6d585045b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 12 Nov 2012 10:07:36 +0100 +Subject: ALSA: hda - Add a missing quirk entry for iMac 9,1 + +From: Takashi Iwai + +commit 05193639ca977cc889668718adb38db6d585045b upstream. + +This is another variant of iMac 9,1 with a different codec SSID. + +Reported-and-tested-by: Everaldo Canuto +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5458,6 +5458,7 @@ static const struct snd_pci_quirk alc882 + SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), + SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), + SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), ++ SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), + SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), + SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), + SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), diff --git a/queue-3.4/alsa-hda-add-new-codec-alc668-and-alc900-default-name-alc1150.patch b/queue-3.4/alsa-hda-add-new-codec-alc668-and-alc900-default-name-alc1150.patch new file mode 100644 index 00000000000..ad803691ca6 --- /dev/null +++ b/queue-3.4/alsa-hda-add-new-codec-alc668-and-alc900-default-name-alc1150.patch @@ -0,0 +1,35 @@ +From 19a62823eae453619604636082085812c14ee391 Mon Sep 17 00:00:00 2001 +From: Kailang Yang +Date: Thu, 8 Nov 2012 10:25:37 +0100 +Subject: ALSA: hda - Add new codec ALC668 and ALC900 (default name ALC1150) + +From: Kailang Yang + +commit 19a62823eae453619604636082085812c14ee391 upstream. + +Signed-off-by: Kailang Yang +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7047,6 +7047,7 @@ static const struct hda_codec_preset snd + .patch = patch_alc662 }, + { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, + { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, ++ { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, + { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, + { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, + { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, +@@ -7064,6 +7065,7 @@ static const struct hda_codec_preset snd + { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, + { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, + { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 }, ++ { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 }, + {} /* terminator */ + }; + diff --git a/queue-3.4/alsa-hda-cirrus-fix-coefficient-index-for-beep-configuration.patch b/queue-3.4/alsa-hda-cirrus-fix-coefficient-index-for-beep-configuration.patch new file mode 100644 index 00000000000..3c8d1b1848a --- /dev/null +++ b/queue-3.4/alsa-hda-cirrus-fix-coefficient-index-for-beep-configuration.patch @@ -0,0 +1,28 @@ +From 5a83b4b5a391f07141b157ac9daa51c409e71ab5 Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Thu, 1 Nov 2012 13:42:37 +0100 +Subject: ALSA: hda: Cirrus: Fix coefficient index for beep configuration + +From: Alexander Stein + +commit 5a83b4b5a391f07141b157ac9daa51c409e71ab5 upstream. + +Signed-off-by: Alexander Stein +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_cirrus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -1112,7 +1112,7 @@ static const struct hda_verb cs_coef_ini + | 0x0400 /* Disable Coefficient Auto increment */ + )}, + /* Beep */ +- {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG}, ++ {0x11, AC_VERB_SET_COEF_INDEX, IDX_BEEP_CFG}, + {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */ + + {} /* terminator */ diff --git a/queue-3.4/alsa-hda-fix-digital-microphone-on-cs420x.patch b/queue-3.4/alsa-hda-fix-digital-microphone-on-cs420x.patch new file mode 100644 index 00000000000..aab592b8ef3 --- /dev/null +++ b/queue-3.4/alsa-hda-fix-digital-microphone-on-cs420x.patch @@ -0,0 +1,59 @@ +From 16337e028a6dae9fbdd718c0d42161540a668ff3 Mon Sep 17 00:00:00 2001 +From: Daniel J Blueman +Date: Sun, 4 Nov 2012 13:19:03 +0800 +Subject: ALSA: HDA: Fix digital microphone on CS420x + +From: Daniel J Blueman + +commit 16337e028a6dae9fbdd718c0d42161540a668ff3 upstream. + +Correctly enable the digital microphones with the right bits in the +right coeffecient registers on Cirrus CS4206/7 codecs. It also +prevents misconfiguring ADC1/2. + +This fixes the digital mic on the Macbook Pro 10,1/Retina. + +Based-on-patch-by: Alexander Stein +Signed-off-by: Daniel J Blueman +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_cirrus.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -95,8 +95,8 @@ enum { + #define CS420X_VENDOR_NID 0x11 + #define CS_DIG_OUT1_PIN_NID 0x10 + #define CS_DIG_OUT2_PIN_NID 0x15 +-#define CS_DMIC1_PIN_NID 0x12 +-#define CS_DMIC2_PIN_NID 0x0e ++#define CS_DMIC1_PIN_NID 0x0e ++#define CS_DMIC2_PIN_NID 0x12 + + /* coef indices */ + #define IDX_SPDIF_STAT 0x0000 +@@ -1084,14 +1084,18 @@ static void init_input(struct hda_codec + cs_automic(codec); + + coef = 0x000a; /* ADC1/2 - Digital and Analog Soft Ramp */ ++ cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); ++ ++ coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG); + if (is_active_pin(codec, CS_DMIC2_PIN_NID)) +- coef |= 0x0500; /* DMIC2 2 chan on, GPIO1 off */ ++ coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */ + if (is_active_pin(codec, CS_DMIC1_PIN_NID)) +- coef |= 0x1800; /* DMIC1 2 chan on, GPIO0 off ++ coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off + * No effect if SPDIF_OUT2 is + * selected in IDX_SPDIF_CTL. + */ +- cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); ++ ++ cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef); + } else { + if (spec->mic_detect) + cs_automic(codec); diff --git a/queue-3.4/alsa-hda-fix-empty-dac-filling-in-patch_via.c.patch b/queue-3.4/alsa-hda-fix-empty-dac-filling-in-patch_via.c.patch new file mode 100644 index 00000000000..9e6553543f9 --- /dev/null +++ b/queue-3.4/alsa-hda-fix-empty-dac-filling-in-patch_via.c.patch @@ -0,0 +1,61 @@ +From 5b3761954dac2d1393beef8210eb8cee81d16b8d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 7 Nov 2012 10:32:47 +0100 +Subject: ALSA: hda - Fix empty DAC filling in patch_via.c + +From: Takashi Iwai + +commit 5b3761954dac2d1393beef8210eb8cee81d16b8d upstream. + +In via_auto_fill_adc_nids(), the parser tries to fill dac_nids[] at +the point of the current line-out (i). When no valid path is found +for this output, this results in dac = 0, thus it creates a hole in +dac_nids[]. This confuses is_empty_dac() and trims the detected DAC +in later reference. + +This patch fixes the bug by appending DAC properly to dac_nids[] in +via_auto_fill_adc_nids(). + +Reported-by: Massimo Del Fedele +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_via.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +--- a/sound/pci/hda/patch_via.c ++++ b/sound/pci/hda/patch_via.c +@@ -1868,11 +1868,11 @@ static int via_auto_fill_dac_nids(struct + { + struct via_spec *spec = codec->spec; + const struct auto_pin_cfg *cfg = &spec->autocfg; +- int i, dac_num; ++ int i; + hda_nid_t nid; + ++ spec->multiout.num_dacs = 0; + spec->multiout.dac_nids = spec->private_dac_nids; +- dac_num = 0; + for (i = 0; i < cfg->line_outs; i++) { + hda_nid_t dac = 0; + nid = cfg->line_out_pins[i]; +@@ -1883,16 +1883,13 @@ static int via_auto_fill_dac_nids(struct + if (!i && parse_output_path(codec, nid, dac, 1, + &spec->out_mix_path)) + dac = spec->out_mix_path.path[0]; +- if (dac) { +- spec->private_dac_nids[i] = dac; +- dac_num++; +- } ++ if (dac) ++ spec->private_dac_nids[spec->multiout.num_dacs++] = dac; + } + if (!spec->out_path[0].depth && spec->out_mix_path.depth) { + spec->out_path[0] = spec->out_mix_path; + spec->out_mix_path.depth = 0; + } +- spec->multiout.num_dacs = dac_num; + return 0; + } + diff --git a/queue-3.4/alsa-hda-fix-invalid-connections-in-vt1802-codec.patch b/queue-3.4/alsa-hda-fix-invalid-connections-in-vt1802-codec.patch new file mode 100644 index 00000000000..c30f294a767 --- /dev/null +++ b/queue-3.4/alsa-hda-fix-invalid-connections-in-vt1802-codec.patch @@ -0,0 +1,52 @@ +From ef4da45828603df57e5e21b8aa21a66ce309f79b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 7 Nov 2012 10:37:48 +0100 +Subject: ALSA: hda - Fix invalid connections in VT1802 codec + +From: Takashi Iwai + +commit ef4da45828603df57e5e21b8aa21a66ce309f79b upstream. + +VT1802 codec provides the invalid connection lists of NID 0x24 and +0x33 containing the routes to a non-exist widget 0x3e. This confuses +the auto-parser. Fix it up in the driver by overriding these +connections. + +Reported-by: Massimo Del Fedele +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_via.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/sound/pci/hda/patch_via.c ++++ b/sound/pci/hda/patch_via.c +@@ -3665,6 +3665,18 @@ static void set_widgets_power_state_vt20 + update_power_state(codec, 0x21, AC_PWRST_D3); + } + ++/* NIDs 0x24 and 0x33 on VT1802 have connections to non-existing NID 0x3e ++ * Replace this with mixer NID 0x1c ++ */ ++static void fix_vt1802_connections(struct hda_codec *codec) ++{ ++ static hda_nid_t conn_24[] = { 0x14, 0x1c }; ++ static hda_nid_t conn_33[] = { 0x1c }; ++ ++ snd_hda_override_conn_list(codec, 0x24, ARRAY_SIZE(conn_24), conn_24); ++ snd_hda_override_conn_list(codec, 0x33, ARRAY_SIZE(conn_33), conn_33); ++} ++ + /* patch for vt2002P */ + static int patch_vt2002P(struct hda_codec *codec) + { +@@ -3679,6 +3691,8 @@ static int patch_vt2002P(struct hda_code + spec->aa_mix_nid = 0x21; + override_mic_boost(codec, 0x2b, 0, 3, 40); + override_mic_boost(codec, 0x29, 0, 3, 40); ++ if (spec->codec_type == VT1802) ++ fix_vt1802_connections(codec); + add_secret_dac_path(codec); + + /* automatic parse from the BIOS config */ diff --git a/queue-3.4/alsa-hda-force-to-reset-iec958-status-bits-for-ad-codecs.patch b/queue-3.4/alsa-hda-force-to-reset-iec958-status-bits-for-ad-codecs.patch new file mode 100644 index 00000000000..501a8d68bec --- /dev/null +++ b/queue-3.4/alsa-hda-force-to-reset-iec958-status-bits-for-ad-codecs.patch @@ -0,0 +1,35 @@ +From ae24c3191ba2ab03ec6b4be323e730e00404b4b6 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 5 Nov 2012 12:32:46 +0100 +Subject: ALSA: hda - Force to reset IEC958 status bits for AD codecs + +From: Takashi Iwai + +commit ae24c3191ba2ab03ec6b4be323e730e00404b4b6 upstream. + +Several bug reports suggest that the forcibly resetting IEC958 status +bits is required for AD codecs to get the SPDIF output working +properly after changing streams. + +Original fix credit to Javeed Shaikh. + +BugLink: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/359361 + +Reported-by: Robin Kreis +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_analog.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_analog.c ++++ b/sound/pci/hda/patch_analog.c +@@ -544,6 +544,7 @@ static int ad198x_build_pcms(struct hda_ + if (spec->multiout.dig_out_nid) { + info++; + codec->num_pcms++; ++ codec->spdif_status_reset = 1; + info->name = "AD198x Digital"; + info->pcm_type = HDA_PCM_TYPE_SPDIF; + info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback; diff --git a/queue-3.4/asoc-dapm-use-card_list-during-dapm-shutdown.patch b/queue-3.4/asoc-dapm-use-card_list-during-dapm-shutdown.patch new file mode 100644 index 00000000000..b1ee19390a5 --- /dev/null +++ b/queue-3.4/asoc-dapm-use-card_list-during-dapm-shutdown.patch @@ -0,0 +1,34 @@ +From 445632ad6dda42f4d3f9df2569a852ca0d4ea608 Mon Sep 17 00:00:00 2001 +From: Misael Lopez Cruz +Date: Thu, 8 Nov 2012 12:03:12 -0600 +Subject: ASoC: dapm: Use card_list during DAPM shutdown + +From: Misael Lopez Cruz + +commit 445632ad6dda42f4d3f9df2569a852ca0d4ea608 upstream. + +DAPM shutdown incorrectly uses "list" field of codec struct while +iterating over probed components (codec_dev_list). "list" field +refers to codecs registered in the system, "card_list" field is +used for probed components. + +Signed-off-by: Misael Lopez Cruz +Signed-off-by: Liam Girdwood +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/soc-dapm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/soc-dapm.c ++++ b/sound/soc/soc-dapm.c +@@ -3253,7 +3253,7 @@ void snd_soc_dapm_shutdown(struct snd_so + { + struct snd_soc_codec *codec; + +- list_for_each_entry(codec, &card->codec_dev_list, list) { ++ list_for_each_entry(codec, &card->codec_dev_list, card_list) { + soc_dapm_shutdown_codec(&codec->dapm); + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) + snd_soc_dapm_set_bias_level(&codec->dapm, diff --git a/queue-3.4/asoc-wm8978-pll-incorrectly-configured-when-codec-is-master.patch b/queue-3.4/asoc-wm8978-pll-incorrectly-configured-when-codec-is-master.patch new file mode 100644 index 00000000000..f84f8cfdb64 --- /dev/null +++ b/queue-3.4/asoc-wm8978-pll-incorrectly-configured-when-codec-is-master.patch @@ -0,0 +1,34 @@ +From 55c6f4cb6ef49afbb86222c6a3ff85329199c729 Mon Sep 17 00:00:00 2001 +From: Eric Millbrandt +Date: Fri, 2 Nov 2012 17:05:44 -0400 +Subject: ASoC: wm8978: pll incorrectly configured when codec is master + +From: Eric Millbrandt + +commit 55c6f4cb6ef49afbb86222c6a3ff85329199c729 upstream. + +When MCLK is supplied externally and BCLK and LRC are configured as outputs +(codec is master), the PLL values are only calculated correctly on the first +transmission. On subsequent transmissions, at differenct sample rates, the +wrong PLL values are used. Test for f_opclk instead of f_pllout to determine +if the PLL values are needed. + +Signed-off-by: Eric Millbrandt +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/wm8978.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/codecs/wm8978.c ++++ b/sound/soc/codecs/wm8978.c +@@ -783,7 +783,7 @@ static int wm8978_hw_params(struct snd_p + wm8978->mclk_idx = -1; + f_sel = wm8978->f_mclk; + } else { +- if (!wm8978->f_pllout) { ++ if (!wm8978->f_opclk) { + /* We only enter here, if OPCLK is not used */ + int ret = wm8978_configure_pll(codec); + if (ret < 0) diff --git a/queue-3.4/ptp-update-adjfreq-callback-description.patch b/queue-3.4/ptp-update-adjfreq-callback-description.patch new file mode 100644 index 00000000000..7cde829628c --- /dev/null +++ b/queue-3.4/ptp-update-adjfreq-callback-description.patch @@ -0,0 +1,36 @@ +From 87f4d7c1d36f44b0822053b7e5dedc31fdd0ab99 Mon Sep 17 00:00:00 2001 +From: Jacob Keller +Date: Thu, 1 Nov 2012 12:30:16 +0000 +Subject: ptp: update adjfreq callback description + +From: Jacob Keller + +commit 87f4d7c1d36f44b0822053b7e5dedc31fdd0ab99 upstream. + +This patch updates the adjfreq callback description to include a note that the +delta in ppb is always relative to the base frequency, and not to the current +frequency of the hardware clock. + +Signed-off-by: Jacob Keller +CC: Richard Cochran +CC: John Stultz +Signed-off-by: Jeff Kirsher +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/ptp_clock_kernel.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/include/linux/ptp_clock_kernel.h ++++ b/include/linux/ptp_clock_kernel.h +@@ -50,7 +50,8 @@ struct ptp_clock_request { + * clock operations + * + * @adjfreq: Adjusts the frequency of the hardware clock. +- * parameter delta: Desired period change in parts per billion. ++ * parameter delta: Desired frequency offset from nominal frequency ++ * in parts per billion + * + * @adjtime: Shifts the time of the hardware clock. + * parameter delta: Desired change in nanoseconds. diff --git a/queue-3.4/series b/queue-3.4/series index afb2348acb1..a2e627e0de8 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -8,3 +8,15 @@ fanotify-fix-missing-break.patch module-fix-out-by-one-error-in-kallsyms.patch cifs-fix-potential-buffer-overrun-in-cifs.idmap-handling-code.patch crypto-cryptd-disable-softirqs-in-cryptd_queue_worker-to-prevent-data-corruption.patch +ptp-update-adjfreq-callback-description.patch +alsa-hda-cirrus-fix-coefficient-index-for-beep-configuration.patch +alsa-hda-fix-digital-microphone-on-cs420x.patch +alsa-hda-force-to-reset-iec958-status-bits-for-ad-codecs.patch +alsa-hda-fix-empty-dac-filling-in-patch_via.c.patch +alsa-hda-fix-invalid-connections-in-vt1802-codec.patch +alsa-hda-add-new-codec-alc668-and-alc900-default-name-alc1150.patch +alsa-hda-add-a-missing-quirk-entry-for-imac-9-1.patch +asoc-wm8978-pll-incorrectly-configured-when-codec-is-master.patch +asoc-dapm-use-card_list-during-dapm-shutdown.patch +ubifs-fix-mounting-problems-after-power-cuts.patch +ubifs-introduce-categorized-lprops-counter.patch diff --git a/queue-3.4/ubifs-fix-mounting-problems-after-power-cuts.patch b/queue-3.4/ubifs-fix-mounting-problems-after-power-cuts.patch new file mode 100644 index 00000000000..306552aa010 --- /dev/null +++ b/queue-3.4/ubifs-fix-mounting-problems-after-power-cuts.patch @@ -0,0 +1,60 @@ +From a28ad42a4a0c6f302f488f26488b8b37c9b30024 Mon Sep 17 00:00:00 2001 +From: Artem Bityutskiy +Date: Tue, 9 Oct 2012 16:20:15 +0300 +Subject: UBIFS: fix mounting problems after power cuts + +From: Artem Bityutskiy + +commit a28ad42a4a0c6f302f488f26488b8b37c9b30024 upstream. + +This is a bugfix for a problem with the following symptoms: + +1. A power cut happens +2. After reboot, we try to mount UBIFS +3. Mount fails with "No space left on device" error message + +UBIFS complains like this: + +UBIFS error (pid 28225): grab_empty_leb: could not find an empty LEB + +The root cause of this problem is that when we mount, not all LEBs are +categorized. Only those which were read are. However, the +'ubifs_find_free_leb_for_idx()' function assumes that all LEBs were +categorized and 'c->freeable_cnt' is valid, which is a false assumption. + +This patch fixes the problem by teaching 'ubifs_find_free_leb_for_idx()' +to always fall back to LPT scanning if no freeable LEBs were found. + +This problem was reported by few people in the past, but Brent Taylor +was able to reproduce it and send me a flash image which cannot be mounted, +which made it easy to hunt the bug. Kudos to Brent. + +Reported-by: Brent Taylor +Signed-off-by: Artem Bityutskiy +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ubifs/find.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/fs/ubifs/find.c ++++ b/fs/ubifs/find.c +@@ -681,8 +681,16 @@ int ubifs_find_free_leb_for_idx(struct u + if (!lprops) { + lprops = ubifs_fast_find_freeable(c); + if (!lprops) { +- ubifs_assert(c->freeable_cnt == 0); +- if (c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) { ++ /* ++ * The first condition means the following: go scan the ++ * LPT if there are uncategorized lprops, which means ++ * there may be freeable LEBs there (UBIFS does not ++ * store the information about freeable LEBs in the ++ * master node). ++ */ ++ if (c->in_a_category_cnt != c->main_lebs || ++ c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) { ++ ubifs_assert(c->freeable_cnt == 0); + lprops = scan_for_leb_for_idx(c); + if (IS_ERR(lprops)) { + err = PTR_ERR(lprops); diff --git a/queue-3.4/ubifs-introduce-categorized-lprops-counter.patch b/queue-3.4/ubifs-introduce-categorized-lprops-counter.patch new file mode 100644 index 00000000000..8b1ad671d98 --- /dev/null +++ b/queue-3.4/ubifs-introduce-categorized-lprops-counter.patch @@ -0,0 +1,63 @@ +From 98a1eebda3cb2a84ecf1f219bb3a95769033d1bf Mon Sep 17 00:00:00 2001 +From: Artem Bityutskiy +Date: Wed, 10 Oct 2012 10:55:28 +0300 +Subject: UBIFS: introduce categorized lprops counter + +From: Artem Bityutskiy + +commit 98a1eebda3cb2a84ecf1f219bb3a95769033d1bf upstream. + +This commit is a preparation for a subsequent bugfix. We introduce a +counter for categorized lprops. + +Signed-off-by: Artem Bityutskiy +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ubifs/lprops.c | 6 ++++++ + fs/ubifs/ubifs.h | 3 +++ + 2 files changed, 9 insertions(+) + +--- a/fs/ubifs/lprops.c ++++ b/fs/ubifs/lprops.c +@@ -300,8 +300,11 @@ void ubifs_add_to_cat(struct ubifs_info + default: + ubifs_assert(0); + } ++ + lprops->flags &= ~LPROPS_CAT_MASK; + lprops->flags |= cat; ++ c->in_a_category_cnt += 1; ++ ubifs_assert(c->in_a_category_cnt <= c->main_lebs); + } + + /** +@@ -334,6 +337,9 @@ static void ubifs_remove_from_cat(struct + default: + ubifs_assert(0); + } ++ ++ c->in_a_category_cnt -= 1; ++ ubifs_assert(c->in_a_category_cnt >= 0); + } + + /** +--- a/fs/ubifs/ubifs.h ++++ b/fs/ubifs/ubifs.h +@@ -1184,6 +1184,8 @@ struct ubifs_debug_info; + * @freeable_list: list of freeable non-index LEBs (free + dirty == @leb_size) + * @frdi_idx_list: list of freeable index LEBs (free + dirty == @leb_size) + * @freeable_cnt: number of freeable LEBs in @freeable_list ++ * @in_a_category_cnt: count of lprops which are in a certain category, which ++ * basically meants that they were loaded from the flash + * + * @ltab_lnum: LEB number of LPT's own lprops table + * @ltab_offs: offset of LPT's own lprops table +@@ -1413,6 +1415,7 @@ struct ubifs_info { + struct list_head freeable_list; + struct list_head frdi_idx_list; + int freeable_cnt; ++ int in_a_category_cnt; + + int ltab_lnum; + int ltab_offs;