{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/28546829","id":28546829,"diff_hunk":"@@ -31,28 +32,80 @@ import (\n \t\"github.com/golang/glog\"\n )\n \n-const FlagBind = syscall.MS_BIND\n-const FlagReadOnly = syscall.MS_RDONLY\n+const (\n+\t// How many times to retry for a consistent read of /proc/mounts.\n+\tmaxListTries = 3\n+\t// Number of fields per line in \"/proc/mounts\", as per the fstab man page.\n+\texpectedNumFieldsPerLine = 6\n+)\n \n // Mounter implements mount.Interface for linux platform.\n type Mounter struct{}\n \n-// Mount wraps syscall.Mount()\n-func (mounter *Mounter) Mount(source string, target string, fstype string, flags uintptr, data string) error {\n-\tglog.V(5).Infof(\"Mounting %s %s %s %d %s\", source, target, fstype, flags, data)\n-\treturn syscall.Mount(source, target, fstype, flags, data)\n+// Mount mounts source to target as fstype with given options. 'source' and 'fstype' must\n+// be an emtpy string in case it's not required, e.g. for remount, or for auto filesystem\n+// type, where kernel handles fs type for you. The mount 'options' currently come from\n+// mount(8), if no more option is required, call Mount with an empty string list or nil.\n+func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {\n+\tglog.V(5).Infof(\"Mounting %s %s %s %v\", source, target, fstype, options)\n+\t// Build mount command as follows:\n+\t//   mount [-t $fstype] [-o $options] [$source] $target\n+\tmountArgs := []string{}\n+\tif len(fstype) > 0 {\n+\t\tmountArgs = append(mountArgs, \"-t\", fstype)\n+\t}\n+\tif options != nil {\n+\t\t// If options is an empty list, this is a no-op.\n+\t\tmountArgs = append(mountArgs, options...)\n+\t}\n+\tif len(source) > 0 {\n+\t\tmountArgs = append(mountArgs, source, target)\n+\t} else {\n+\t\tmountArgs = append(mountArgs, target)\n+\t}\n+\tcommand := exec.Command(\"mount\", mountArgs...)\n+\toutput, err := command.CombinedOutput()\n+\tif err != nil {\n+\t\tglog.Errorf(\"Mount failed: %v\\nMounting arguments: %s %s %s %v\\nOutput: %s\\n\",\n+\t\t\terr, source, target, fstype, options, string(output))\n+\t\treturn err\n+\t}\n+\t// Do a remount if caller asks for readonly bind - the previous mount call\n+\t// will NOT respect readonly option and will mount target as read/write.\n+\tif isReadOnlyBind(options) {\n+\t\tglog.V(5).Infof(\"Remounting %s as readonly bind\", target)\n+\t\tcommand = exec.Command(\"mount\", \"-o\", \"remount,ro\", target)","path":"pkg/util/mount/mount_linux.go","position":60,"original_position":60,"commit_id":"779aa2885ff8baadf7484430b76f351e095ce9a9","original_commit_id":"779aa2885ff8baadf7484430b76f351e095ce9a9","user":{"login":"eparis","id":8093535,"avatar_url":"https://avatars.githubusercontent.com/u/8093535?v=3","gravatar_id":"","url":"https://api.github.com/users/eparis","html_url":"https://github.com/eparis","followers_url":"https://api.github.com/users/eparis/followers","following_url":"https://api.github.com/users/eparis/following{/other_user}","gists_url":"https://api.github.com/users/eparis/gists{/gist_id}","starred_url":"https://api.github.com/users/eparis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eparis/subscriptions","organizations_url":"https://api.github.com/users/eparis/orgs","repos_url":"https://api.github.com/users/eparis/repos","events_url":"https://api.github.com/users/eparis/events{/privacy}","received_events_url":"https://api.github.com/users/eparis/received_events","type":"User","site_admin":false},"body":"If it was -o bind above and the system does not have a writable /etc/mtab, this will not act correctly. It would be most reliable to make sure if you have bind above you also have it here.\r\n\r\nAs to @rootfs maybe it owuld be wise to ban \"remount\" above and just make sure it is handled correctly here, until such time we have a need to support \"remount\" above....","created_at":"2015-04-16T20:31:14Z","updated_at":"2015-04-16T20:31:14Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6400#discussion_r28546829","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/28546829"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6400#discussion_r28546829"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400","id":32564343,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6400","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6400.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6400.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6400","number":6400,"state":"open","locked":false,"title":"Implement Mount interface using mount(8) and umount(8)","user":{"login":"ddysher","id":2191361,"avatar_url":"https://avatars.githubusercontent.com/u/2191361?v=3","gravatar_id":"","url":"https://api.github.com/users/ddysher","html_url":"https://github.com/ddysher","followers_url":"https://api.github.com/users/ddysher/followers","following_url":"https://api.github.com/users/ddysher/following{/other_user}","gists_url":"https://api.github.com/users/ddysher/gists{/gist_id}","starred_url":"https://api.github.com/users/ddysher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddysher/subscriptions","organizations_url":"https://api.github.com/users/ddysher/orgs","repos_url":"https://api.github.com/users/ddysher/repos","events_url":"https://api.github.com/users/ddysher/events{/privacy}","received_events_url":"https://api.github.com/users/ddysher/received_events","type":"User","site_admin":false},"body":"Forked from #6269 \r\n\r\nWe have mount_linux.go which implements mount interface for Linux using syscall.  But NFS implements another version of linux mouter based on exec('mount'). To make code cleaner, we should only have one implementation per platform, not for different FS.\r\n\r\nTo make syscall.Mount works on NFS, we need to pass data param, which is this PR does.  We can also implement linux mounter using mount command, once for all.\r\n\r\nOpen for discussion, if it's hard to make it right, then just scratch.\r\n\r\n@thockin @calfonso","created_at":"2015-04-03T01:23:25Z","updated_at":"2015-04-16T20:31:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b21fd6beb124fbdad59fccf595ab588cd81320ad","assignee":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6400/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/779aa2885ff8baadf7484430b76f351e095ce9a9","head":{"label":"ddysher:nfs-volume-mounter","ref":"nfs-volume-mounter","sha":"779aa2885ff8baadf7484430b76f351e095ce9a9","user":{"login":"ddysher","id":2191361,"avatar_url":"https://avatars.githubusercontent.com/u/2191361?v=3","gravatar_id":"","url":"https://api.github.com/users/ddysher","html_url":"https://github.com/ddysher","followers_url":"https://api.github.com/users/ddysher/followers","following_url":"https://api.github.com/users/ddysher/following{/other_user}","gists_url":"https://api.github.com/users/ddysher/gists{/gist_id}","starred_url":"https://api.github.com/users/ddysher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddysher/subscriptions","organizations_url":"https://api.github.com/users/ddysher/orgs","repos_url":"https://api.github.com/users/ddysher/repos","events_url":"https://api.github.com/users/ddysher/events{/privacy}","received_events_url":"https://api.github.com/users/ddysher/received_events","type":"User","site_admin":false},"repo":{"id":22863953,"name":"kubernetes","full_name":"ddysher/kubernetes","owner":{"login":"ddysher","id":2191361,"avatar_url":"https://avatars.githubusercontent.com/u/2191361?v=3","gravatar_id":"","url":"https://api.github.com/users/ddysher","html_url":"https://github.com/ddysher","followers_url":"https://api.github.com/users/ddysher/followers","following_url":"https://api.github.com/users/ddysher/following{/other_user}","gists_url":"https://api.github.com/users/ddysher/gists{/gist_id}","starred_url":"https://api.github.com/users/ddysher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddysher/subscriptions","organizations_url":"https://api.github.com/users/ddysher/orgs","repos_url":"https://api.github.com/users/ddysher/repos","events_url":"https://api.github.com/users/ddysher/events{/privacy}","received_events_url":"https://api.github.com/users/ddysher/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ddysher/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/ddysher/kubernetes","forks_url":"https://api.github.com/repos/ddysher/kubernetes/forks","keys_url":"https://api.github.com/repos/ddysher/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ddysher/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ddysher/kubernetes/teams","hooks_url":"https://api.github.com/repos/ddysher/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/ddysher/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/ddysher/kubernetes/events","assignees_url":"https://api.github.com/repos/ddysher/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/ddysher/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/ddysher/kubernetes/tags","blobs_url":"https://api.github.com/repos/ddysher/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ddysher/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ddysher/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/ddysher/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ddysher/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/ddysher/kubernetes/languages","stargazers_url":"https://api.github.com/repos/ddysher/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/ddysher/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/ddysher/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/ddysher/kubernetes/subscription","commits_url":"https://api.github.com/repos/ddysher/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/ddysher/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/ddysher/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/ddysher/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/ddysher/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/ddysher/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ddysher/kubernetes/merges","archive_url":"https://api.github.com/repos/ddysher/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ddysher/kubernetes/downloads","issues_url":"https://api.github.com/repos/ddysher/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/ddysher/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/ddysher/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/ddysher/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ddysher/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/ddysher/kubernetes/releases{/id}","created_at":"2014-08-12T03:48:56Z","updated_at":"2014-08-15T00:25:36Z","pushed_at":"2015-04-16T19:45:37Z","git_url":"git://github.com/ddysher/kubernetes.git","ssh_url":"git@github.com:ddysher/kubernetes.git","clone_url":"https://github.com/ddysher/kubernetes.git","svn_url":"https://github.com/ddysher/kubernetes","homepage":null,"size":43331,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"0fc94155cf1bcc2ee27f71fe810171b39864cf40","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-04-16T20:30:53Z","pushed_at":"2015-04-16T20:30:52Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":150490,"stargazers_count":7140,"watchers_count":7140,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1401,"mirror_url":null,"open_issues_count":917,"forks":1401,"open_issues":917,"watchers":7140,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6400"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6400"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6400/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6400/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/779aa2885ff8baadf7484430b76f351e095ce9a9"}}}}