isofs: handle CDs with bad root inode but good Joliet root directory
[linux-2.6-microblaze.git] / fs / isofs / inode.c
index 3e4d53e..379c9ed 100644 (file)
@@ -908,8 +908,22 @@ root_found:
         * we then decide whether to use the Joliet descriptor.
         */
        inode = isofs_iget(s, sbi->s_firstdatazone, 0);
-       if (IS_ERR(inode))
-               goto out_no_root;
+
+       /*
+        * Fix for broken CDs with a corrupt root inode but a correct Joliet
+        * root directory.
+        */
+       if (IS_ERR(inode)) {
+               if (joliet_level && sbi->s_firstdatazone != first_data_zone) {
+                       printk(KERN_NOTICE
+                              "ISOFS: root inode is unusable. "
+                              "Disabling Rock Ridge and switching to Joliet.");
+                       sbi->s_rock = 0;
+                       inode = NULL;
+               } else {
+                       goto out_no_root;
+               }
+       }
 
        /*
         * Fix for broken CDs with Rock Ridge and empty ISO root directory but