{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/34067104","id":34067104,"diff_hunk":"@@ -1083,6 +1083,126 @@ func determineDriverCapabilities(version string) error {\n \treturn nil\n }\n \n+// Determine the major and minor number of loopback device\n+func getDeviceMajorMinor(file *os.File) (uint64, uint64, error) {\n+\tstat, err := file.Stat()\n+\tif err != nil {\n+\t\treturn 0, 0, err\n+\t}\n+\n+\tDev := stat.Sys().(*syscall.Stat_t).Rdev\n+\tmajorNum := major(Dev)\n+\tminorNum := minor(Dev)\n+\n+\tlogrus.Debugf(\"devmapper: Major:Minor for device: %s is:%v:%v\", file.Name(), majorNum, minorNum)\n+\treturn majorNum, minorNum, nil\n+}\n+\n+// Given a file which is backing file of a loop back device, find the\n+// loopback device name and its major/minor number.\n+func getLoopFileDeviceMajMin(filename string) (string, uint64, uint64, error) {\n+\tfile, err := os.Open(filename)\n+\tif err != nil {\n+\t\tlogrus.Debugf(\"devmapper: Failed to open file %s\", filename)\n+\t\treturn \"\", 0, 0, err\n+\t}\n+\n+\tdefer file.Close()\n+\tLoopbackDevice := devicemapper.FindLoopDeviceFor(file)\n+\tif LoopbackDevice == nil {\n+\t\treturn \"\", 0, 0, fmt.Errorf(\"devmapper: Unable to find loopback mount for: %s\", filename)\n+\t}\n+\tdefer LoopbackDevice.Close()\n+\n+\tMajor, Minor, err := getDeviceMajorMinor(LoopbackDevice)\n+\tif err != nil {\n+\t\treturn \"\", 0, 0, err\n+\t}\n+\treturn LoopbackDevice.Name(), Major, Minor, nil\n+}\n+\n+// Get the major/minor numbers of thin pool data and metadata devices\n+func (devices *DeviceSet) getThinPoolDataMetaMajMin() (uint64, uint64, uint64, uint64, error) {\n+\tvar params, poolDataMajMin, poolMetadataMajMin string\n+\n+\t_, _, _, params, err := devicemapper.GetTable(devices.getPoolName())\n+\tif err != nil {\n+\t\treturn 0, 0, 0, 0, err\n+\t}\n+\n+\tif _, err = fmt.Sscanf(params, \"%s %s\", &poolMetadataMajMin, &poolDataMajMin); err != nil {\n+\t\treturn 0, 0, 0, 0, err\n+\t}\n+\n+\tlogrus.Debugf(\"devmapper: poolDataMajMin=%s poolMetaMajMin=%s\\n\", poolDataMajMin, poolMetadataMajMin)","path":"daemon/graphdriver/devmapper/deviceset.go","position":55,"original_position":55,"commit_id":"82cd0495182f1c709708cbf9011fa3ca3320400a","original_commit_id":"82cd0495182f1c709708cbf9011fa3ca3320400a","user":{"login":"vbatts","id":67049,"avatar_url":"https://avatars.githubusercontent.com/u/67049?v=3","gravatar_id":"","url":"https://api.github.com/users/vbatts","html_url":"https://github.com/vbatts","followers_url":"https://api.github.com/users/vbatts/followers","following_url":"https://api.github.com/users/vbatts/following{/other_user}","gists_url":"https://api.github.com/users/vbatts/gists{/gist_id}","starred_url":"https://api.github.com/users/vbatts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbatts/subscriptions","organizations_url":"https://api.github.com/users/vbatts/orgs","repos_url":"https://api.github.com/users/vbatts/repos","events_url":"https://api.github.com/users/vbatts/events{/privacy}","received_events_url":"https://api.github.com/users/vbatts/received_events","type":"User","site_admin":false},"body":"for consistency sake, can this log prefix be `[devmapper]` instead of `devmapper:`","created_at":"2015-07-07T17:35:12Z","updated_at":"2015-07-07T17:35:12Z","html_url":"https://github.com/docker/docker/pull/14021#discussion_r34067104","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/14021","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/34067104"},"html":{"href":"https://github.com/docker/docker/pull/14021#discussion_r34067104"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/14021"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/14021","id":38034205,"html_url":"https://github.com/docker/docker/pull/14021","diff_url":"https://github.com/docker/docker/pull/14021.diff","patch_url":"https://github.com/docker/docker/pull/14021.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/14021","number":14021,"state":"open","locked":false,"title":"devicemapper: Check loop devices of existing pool","user":{"login":"rhvgoyal","id":9487534,"avatar_url":"https://avatars.githubusercontent.com/u/9487534?v=3","gravatar_id":"","url":"https://api.github.com/users/rhvgoyal","html_url":"https://github.com/rhvgoyal","followers_url":"https://api.github.com/users/rhvgoyal/followers","following_url":"https://api.github.com/users/rhvgoyal/following{/other_user}","gists_url":"https://api.github.com/users/rhvgoyal/gists{/gist_id}","starred_url":"https://api.github.com/users/rhvgoyal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhvgoyal/subscriptions","organizations_url":"https://api.github.com/users/rhvgoyal/orgs","repos_url":"https://api.github.com/users/rhvgoyal/repos","events_url":"https://api.github.com/users/rhvgoyal/events{/privacy}","received_events_url":"https://api.github.com/users/rhvgoyal/received_events","type":"User","site_admin":false},"body":"Fixes #14020 \r\n\r\nOften it happens that docker is not able to shutdown/remove the thin\r\npool it created because some device has leaked into some mount name\r\nspace. That means device is in use and that means pool can't be removed.\r\n\r\nDocker will leave pool as it is and exit. Later when user starts the\r\ndocker, it finds pool is already there and docker uses it. But docker\r\ndoes not know it is same pool which is using the loop devices. Now\r\ndocker thinks loop devices are not being used. That means it does not\r\ndisplay the data correctly in \"docker info\", giving user wrong information.\r\n\r\nThis patch tries to detect if loop devices as created by docker are\r\nbeing used for pool and fills in the right details in \"docker info\".\r\n\r\nSigned-off-by: Vivek Goyal <vgoyal@redhat.com>","created_at":"2015-06-18T17:57:00Z","updated_at":"2015-07-07T17:35:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f11b4bb460b95763fc3eacb92bf9309430839c14","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/14021/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/14021/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/14021/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/82cd0495182f1c709708cbf9011fa3ca3320400a","head":{"label":"rhvgoyal:detect-pool-loopback-devices","ref":"detect-pool-loopback-devices","sha":"82cd0495182f1c709708cbf9011fa3ca3320400a","user":{"login":"rhvgoyal","id":9487534,"avatar_url":"https://avatars.githubusercontent.com/u/9487534?v=3","gravatar_id":"","url":"https://api.github.com/users/rhvgoyal","html_url":"https://github.com/rhvgoyal","followers_url":"https://api.github.com/users/rhvgoyal/followers","following_url":"https://api.github.com/users/rhvgoyal/following{/other_user}","gists_url":"https://api.github.com/users/rhvgoyal/gists{/gist_id}","starred_url":"https://api.github.com/users/rhvgoyal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhvgoyal/subscriptions","organizations_url":"https://api.github.com/users/rhvgoyal/orgs","repos_url":"https://api.github.com/users/rhvgoyal/repos","events_url":"https://api.github.com/users/rhvgoyal/events{/privacy}","received_events_url":"https://api.github.com/users/rhvgoyal/received_events","type":"User","site_admin":false},"repo":{"id":26138734,"name":"docker","full_name":"rhvgoyal/docker","owner":{"login":"rhvgoyal","id":9487534,"avatar_url":"https://avatars.githubusercontent.com/u/9487534?v=3","gravatar_id":"","url":"https://api.github.com/users/rhvgoyal","html_url":"https://github.com/rhvgoyal","followers_url":"https://api.github.com/users/rhvgoyal/followers","following_url":"https://api.github.com/users/rhvgoyal/following{/other_user}","gists_url":"https://api.github.com/users/rhvgoyal/gists{/gist_id}","starred_url":"https://api.github.com/users/rhvgoyal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhvgoyal/subscriptions","organizations_url":"https://api.github.com/users/rhvgoyal/orgs","repos_url":"https://api.github.com/users/rhvgoyal/repos","events_url":"https://api.github.com/users/rhvgoyal/events{/privacy}","received_events_url":"https://api.github.com/users/rhvgoyal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhvgoyal/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/rhvgoyal/docker","forks_url":"https://api.github.com/repos/rhvgoyal/docker/forks","keys_url":"https://api.github.com/repos/rhvgoyal/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhvgoyal/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhvgoyal/docker/teams","hooks_url":"https://api.github.com/repos/rhvgoyal/docker/hooks","issue_events_url":"https://api.github.com/repos/rhvgoyal/docker/issues/events{/number}","events_url":"https://api.github.com/repos/rhvgoyal/docker/events","assignees_url":"https://api.github.com/repos/rhvgoyal/docker/assignees{/user}","branches_url":"https://api.github.com/repos/rhvgoyal/docker/branches{/branch}","tags_url":"https://api.github.com/repos/rhvgoyal/docker/tags","blobs_url":"https://api.github.com/repos/rhvgoyal/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhvgoyal/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhvgoyal/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhvgoyal/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhvgoyal/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/rhvgoyal/docker/languages","stargazers_url":"https://api.github.com/repos/rhvgoyal/docker/stargazers","contributors_url":"https://api.github.com/repos/rhvgoyal/docker/contributors","subscribers_url":"https://api.github.com/repos/rhvgoyal/docker/subscribers","subscription_url":"https://api.github.com/repos/rhvgoyal/docker/subscription","commits_url":"https://api.github.com/repos/rhvgoyal/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhvgoyal/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhvgoyal/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhvgoyal/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhvgoyal/docker/contents/{+path}","compare_url":"https://api.github.com/repos/rhvgoyal/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhvgoyal/docker/merges","archive_url":"https://api.github.com/repos/rhvgoyal/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhvgoyal/docker/downloads","issues_url":"https://api.github.com/repos/rhvgoyal/docker/issues{/number}","pulls_url":"https://api.github.com/repos/rhvgoyal/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/rhvgoyal/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/rhvgoyal/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhvgoyal/docker/labels{/name}","releases_url":"https://api.github.com/repos/rhvgoyal/docker/releases{/id}","created_at":"2014-11-03T21:06:15Z","updated_at":"2015-04-21T22:11:54Z","pushed_at":"2015-06-25T21:33:46Z","git_url":"git://github.com/rhvgoyal/docker.git","ssh_url":"git@github.com:rhvgoyal/docker.git","clone_url":"https://github.com/rhvgoyal/docker.git","svn_url":"https://github.com/rhvgoyal/docker","homepage":"http://www.docker.com","size":58188,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"aa4f495caee6ba66ce33a8ef4db0d4067c17195b","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-07-07T17:06:28Z","pushed_at":"2015-07-07T17:32:50Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":220119,"stargazers_count":23069,"watchers_count":23069,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5662,"mirror_url":null,"open_issues_count":1123,"forks":5662,"open_issues":1123,"watchers":23069,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/14021"},"html":{"href":"https://github.com/docker/docker/pull/14021"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/14021"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/14021/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/14021/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/14021/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/82cd0495182f1c709708cbf9011fa3ca3320400a"}}}}