<div dir="ltr"><div>I have to support pushd and popd from userspace in a filesystem that I have designed.</div><div><br></div><div>In my filesystem driver, to implement it I have done the following </div><div><br></div><div>
for popd - the driver implementation is </div><a href="https://github.com/disdi/hepunion/blob/master/fs/hepunion/hepunion.h#L386">https://github.com/disdi/hepunion/blob/master/fs/hepunion/hepunion.h#L386</a><div><div>#define pop_root()<span class="" style="white-space:pre">                                                                </span>\</div>
<div><span class="" style="white-space:pre">        </span>current-&gt;fsuid = context-&gt;uid;<span class="" style="white-space:pre">                                </span>\</div><div><span class="" style="white-space:pre">        </span>current-&gt;fsgid = context-&gt;gid;<span class="" style="white-space:pre">                                </span>\</div>
<div><span class="" style="white-space:pre">        </span>recursive_mutex_unlock(&amp;context-&gt;id_lock)</div></div><div><br></div><div><br><div>for pushd - the driver implementation is <br></div><div><a href="https://github.com/disdi/hepunion/blob/master/fs/hepunion/hepunion.h#L393">https://github.com/disdi/hepunion/blob/master/fs/hepunion/hepunion.h#L393</a><br>
</div></div><div><div>#define push_root()<span class="" style="white-space:pre">                                                                </span>\</div><div><span class="" style="white-space:pre">        </span>recursive_mutex_lock(&amp;context-&gt;id_lock);<span class="" style="white-space:pre">        </span>\</div>
<div><span class="" style="white-space:pre">        </span>context-&gt;uid = current-&gt;fsuid;<span class="" style="white-space:pre">                                </span>\</div><div><span class="" style="white-space:pre">        </span>context-&gt;gid = current-&gt;fsgid;<span class="" style="white-space:pre">                                </span>\</div>
<div><span class="" style="white-space:pre">        </span>current-&gt;fsuid = 0;<span class="" style="white-space:pre">                                                        </span>\</div><div><span class="" style="white-space:pre">        </span>current-&gt;fsgid = 0</div></div><div>
<br></div><div><br></div><div>But this implementation is failing at run time.</div><div>This is the script with which I am testing this driver. All pushd and propd are not working in this script.</div><div><br></div><div>
<div style="font-family:arial,sans-serif;font-size:13px"><font face="arial, sans-serif">After trying many other alternatives, I think overriding commits would be a better choice. So then I would try overriding commits as the below link</font></div>
<div style="font-family:arial,sans-serif;font-size:13px"><a href="http://lxr.free-electrons.com/source/fs/open.c?v=3.8#L312" target="_blank">http://lxr.free-electrons.com/source/fs/open.c?v=3.8#L312</a></div></div><div><br>
</div><div>Regards,</div><div>Saket Sinha</div><div>Can somebody help<br></div></div>