Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-11626

mdc: obd might go away while referenced by code in mdc_changelog

Details

    • 3
    • 9223372036854775807

    Description

      In lustre/mdc/mdc_changelog.c:

      /**
       * Find the OBD device associated to a changelog character device.
       * @param[in]  cdev  character device instance descriptor
       * @return corresponding OBD device or NULL if none was found.
       */
      static struct obd_device *chlg_obd_get(dev_t cdev)
      {
      	int minor = MINOR(cdev);
      	struct obd_device *obd = NULL;
      	struct chlg_registered_dev *curr;
      
      	mutex_lock(&chlg_registered_dev_lock);
      	list_for_each_entry(curr, &chlg_registered_devices, ced_link) {
      		if (curr->ced_misc.minor == minor) {
      			/* take the first available OBD device attached */
      			obd = list_first_entry(&curr->ced_obds,
      					       struct obd_device,
      					       u.cli.cl_chg_dev_linkage);
      			break;
      		}
      	}
      	mutex_unlock(&chlg_registered_dev_lock);
      	return obd;
      }
      

      The "take the first available OBD device attached" approach is broken as that OBD might go away while the changelog is being read.

      Here is an example of how things can go wrong:

      • mount lustre at /mnt/lustre;
      • mount the same lustre filesystem at /mnt/lustre2;
      • open /dev/changelog-lustre-MDT0000 in writing mode;
      • unmount /mnt/lustre;
      • write 'clear:cl0:0' to the opened chardevice.

      That triggers an LBUG.

      Attachments

        Issue Links

          Activity

            [LU-11626] mdc: obd might go away while referenced by code in mdc_changelog
            pjones Peter Jones made changes -
            Reporter Original: Quentin Bouget [ bougetq ] New: CEA [ cealustre ]
            pjones Peter Jones made changes -
            Link New: This issue is related to JFC-20 [ JFC-20 ]
            pjones Peter Jones made changes -
            Labels Original: LTS12
            pjones Peter Jones made changes -
            Fix Version/s New: Lustre 2.12.4 [ 14690 ]

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36338/
            Subject: LU-11626 mdc: hold obd while processing changelog
            Project: fs/lustre-release
            Branch: b2_12
            Current Patch Set:
            Commit: 9d88030b8a532de3bec3f75d01ec108bfba97082

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36338/ Subject: LU-11626 mdc: hold obd while processing changelog Project: fs/lustre-release Branch: b2_12 Current Patch Set: Commit: 9d88030b8a532de3bec3f75d01ec108bfba97082
            pjones Peter Jones added a comment -

            James

            We tagged RC1 this morning so, while there's still a chance, it is looking unlikely as things stand

            Peter

            pjones Peter Jones added a comment - James We tagged RC1 this morning so, while there's still a chance, it is looking unlikely as things stand Peter

            Peter, any chance this can land for the 2.12.3 release

            simmonsja James A Simmons added a comment - Peter, any chance this can land for the 2.12.3 release

            Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36338
            Subject: LU-11626 mdc: hold obd while processing changelog
            Project: fs/lustre-release
            Branch: b2_12
            Current Patch Set: 1
            Commit: 24935d83103d44dee84a16a7e304bb13180ec22d

            gerrit Gerrit Updater added a comment - Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36338 Subject: LU-11626 mdc: hold obd while processing changelog Project: fs/lustre-release Branch: b2_12 Current Patch Set: 1 Commit: 24935d83103d44dee84a16a7e304bb13180ec22d
            pjones Peter Jones made changes -
            Labels New: LTS12
            pjones Peter Jones made changes -
            Link Original: This issue is related to JFC-10 [ JFC-10 ]

            People

              hongchao.zhang Hongchao Zhang
              cealustre CEA
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: