Merge pull request #125620 from ritster/mountinfo-dep-update
version update: github.com/moby/sys/mountinfo from v0.6.2 -> v0.7.1
This commit is contained in:
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -175,7 +175,7 @@ require ( | |||||||
| 	github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect | 	github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect | ||||||
| 	github.com/mitchellh/go-wordwrap v1.0.1 // indirect | 	github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||||||
| 	github.com/moby/spdystream v0.2.0 // indirect | 	github.com/moby/spdystream v0.2.0 // indirect | ||||||
| 	github.com/moby/sys/mountinfo v0.6.2 // indirect | 	github.com/moby/sys/mountinfo v0.7.1 // indirect | ||||||
| 	github.com/moby/term v0.5.0 // indirect | 	github.com/moby/term v0.5.0 // indirect | ||||||
| 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||||||
| 	github.com/modern-go/reflect2 v1.0.2 // indirect | 	github.com/modern-go/reflect2 v1.0.2 // indirect | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -509,8 +509,8 @@ github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ= | |||||||
| github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs= | github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs= | ||||||
| github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= | github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= | ||||||
| github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= | github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= | ||||||
| github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= | github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= | ||||||
| github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= | github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= | ||||||
| github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= | github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= | ||||||
| github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= | github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= | ||||||
| github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ module k8s.io/mount-utils | |||||||
| go 1.22.0 | go 1.22.0 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/moby/sys/mountinfo v0.6.2 | 	github.com/moby/sys/mountinfo v0.7.1 | ||||||
| 	github.com/opencontainers/runc v1.1.13 | 	github.com/opencontainers/runc v1.1.13 | ||||||
| 	github.com/stretchr/testify v1.8.4 | 	github.com/stretchr/testify v1.8.4 | ||||||
| 	golang.org/x/sys v0.20.0 | 	golang.org/x/sys v0.20.0 | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								staging/src/k8s.io/mount-utils/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								staging/src/k8s.io/mount-utils/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -23,8 +23,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | |||||||
| github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||||
| github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||||||
| github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | ||||||
| github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= | github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= | ||||||
| github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= | github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= | ||||||
| github.com/mrunalp/fileutils v0.5.1/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= | github.com/mrunalp/fileutils v0.5.1/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= | ||||||
| github.com/opencontainers/runc v1.1.13 h1:98S2srgG9vw0zWcDpFMn5TRrh8kLxa/5OFUstuUhmRs= | github.com/opencontainers/runc v1.1.13 h1:98S2srgG9vw0zWcDpFMn5TRrh8kLxa/5OFUstuUhmRs= | ||||||
| github.com/opencontainers/runc v1.1.13/go.mod h1:R016aXacfp/gwQBYw2FDGa9m+n6atbLWrYY8hNMT/sA= | github.com/opencontainers/runc v1.1.13/go.mod h1:R016aXacfp/gwQBYw2FDGa9m+n6atbLWrYY8hNMT/sA= | ||||||
|   | |||||||
							
								
								
									
										42
									
								
								vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										42
									
								
								vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -5,15 +5,19 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"io" | 	"io" | ||||||
| 	"os" | 	"os" | ||||||
|  | 	"runtime" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
|  | 	"sync" | ||||||
|  |  | ||||||
|  | 	"golang.org/x/sys/unix" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // GetMountsFromReader retrieves a list of mounts from the | // GetMountsFromReader retrieves a list of mounts from the | ||||||
| // reader provided, with an optional filter applied (use nil | // reader provided, with an optional filter applied (use nil | ||||||
| // for no filter). This can be useful in tests or benchmarks | // for no filter). This can be useful in tests or benchmarks | ||||||
| // that provide fake mountinfo data, or when a source other | // that provide fake mountinfo data, or when a source other | ||||||
| // than /proc/self/mountinfo needs to be read from. | // than /proc/thread-self/mountinfo needs to be read from. | ||||||
| // | // | ||||||
| // This function is Linux-specific. | // This function is Linux-specific. | ||||||
| func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { | func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { | ||||||
| @@ -127,8 +131,40 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { | |||||||
| 	return out, nil | 	return out, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func parseMountTable(filter FilterFunc) ([]*Info, error) { | var ( | ||||||
| 	f, err := os.Open("/proc/self/mountinfo") | 	haveProcThreadSelf     bool | ||||||
|  | 	haveProcThreadSelfOnce sync.Once | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func parseMountTable(filter FilterFunc) (_ []*Info, err error) { | ||||||
|  | 	haveProcThreadSelfOnce.Do(func() { | ||||||
|  | 		_, err := os.Stat("/proc/thread-self/mountinfo") | ||||||
|  | 		haveProcThreadSelf = err == nil | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	// We need to lock ourselves to the current OS thread in order to make sure | ||||||
|  | 	// that the thread referenced by /proc/thread-self stays alive until we | ||||||
|  | 	// finish parsing the file. | ||||||
|  | 	runtime.LockOSThread() | ||||||
|  | 	defer runtime.UnlockOSThread() | ||||||
|  |  | ||||||
|  | 	var f *os.File | ||||||
|  | 	if haveProcThreadSelf { | ||||||
|  | 		f, err = os.Open("/proc/thread-self/mountinfo") | ||||||
|  | 	} else { | ||||||
|  | 		// On pre-3.17 kernels (such as CentOS 7), we don't have | ||||||
|  | 		// /proc/thread-self/ so we need to manually construct | ||||||
|  | 		// /proc/self/task/<tid>/ as a fallback. | ||||||
|  | 		f, err = os.Open("/proc/self/task/" + strconv.Itoa(unix.Gettid()) + "/mountinfo") | ||||||
|  | 		if os.IsNotExist(err) { | ||||||
|  | 			// If /proc/self/task/... failed, it means that our active pid | ||||||
|  | 			// namespace doesn't match the pid namespace of the /proc mount. In | ||||||
|  | 			// this case we just have to make do with /proc/self, since there | ||||||
|  | 			// is no other way of figuring out our tid in a parent pid | ||||||
|  | 			// namespace on pre-3.17 kernels. | ||||||
|  | 			f, err = os.Open("/proc/self/mountinfo") | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -426,7 +426,7 @@ github.com/moby/ipvs | |||||||
| ## explicit; go 1.13 | ## explicit; go 1.13 | ||||||
| github.com/moby/spdystream | github.com/moby/spdystream | ||||||
| github.com/moby/spdystream/spdy | github.com/moby/spdystream/spdy | ||||||
| # github.com/moby/sys/mountinfo v0.6.2 | # github.com/moby/sys/mountinfo v0.7.1 | ||||||
| ## explicit; go 1.16 | ## explicit; go 1.16 | ||||||
| github.com/moby/sys/mountinfo | github.com/moby/sys/mountinfo | ||||||
| # github.com/moby/term v0.5.0 | # github.com/moby/term v0.5.0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot