Lines Matching refs:dip
268 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
273 inode = gfs2_lookupi(dip, &qstr, 1);
310 struct gfs2_inode *dip = GFS2_I(dir);
326 if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) {
327 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
351 * @dip: Directory in which dinode is to be created
358 static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
363 error = gfs2_permission(&nop_mnt_idmap, &dip->i_inode,
369 if (!dip->i_inode.i_nlink)
372 if (dip->i_entries == (u32)-1)
374 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
380 static void munge_mode_uid_gid(const struct gfs2_inode *dip,
383 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
384 (dip->i_inode.i_mode & S_ISUID) &&
385 !uid_eq(dip->i_inode.i_uid, GLOBAL_ROOT_UID)) {
388 else if (!uid_eq(dip->i_inode.i_uid, current_fsuid()))
390 inode->i_uid = dip->i_inode.i_uid;
394 if (dip->i_inode.i_mode & S_ISGID) {
397 inode->i_gid = dip->i_inode.i_gid;
486 * @dip: The directory this inode is being created in
492 static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip,
514 gfs2_init_dir(dibh, dip);
527 * @dip: The directory we are linking into
539 static unsigned gfs2_trans_da_blks(const struct gfs2_inode *dip,
543 return da->nr_blocks + gfs2_rg_blocks(dip, da->nr_blocks) +
547 static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
550 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
555 error = gfs2_quota_lock_check(dip, &ap);
559 error = gfs2_inplace_reserve(dip, &ap);
563 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, da, 2), 0);
572 error = gfs2_dir_add(&dip->i_inode, name, ip, da);
576 gfs2_inplace_release(dip);
578 gfs2_quota_unlock(dip);
627 struct gfs2_inode *dip = GFS2_I(dir), *ip;
628 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
638 error = gfs2_qa_get(dip);
646 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
651 error = create_ok(dip, name, mode);
700 munge_mode_uid_gid(dip, inode);
701 check_and_update_goal(dip);
702 ip->i_goal = dip->i_goal;
712 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) ||
718 ip->i_diskflags |= (dip->i_diskflags & GFS2_DIF_INHERIT_JDATA);
725 if (dip->i_diskflags & GFS2_DIF_SYSTEM)
730 if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) ||
731 (dip->i_diskflags & GFS2_DIF_TOPDIR))
774 init_dinode(dip, ip, symname);
796 error = security_inode_init_security(&ip->i_inode, &dip->i_inode, name,
801 error = link_dinode(dip, name, ip, &da);
817 gfs2_qa_put(dip);
854 gfs2_qa_put(dip);
946 struct gfs2_inode *dip = GFS2_I(dir);
958 error = gfs2_qa_get(dip);
962 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
993 if (!dip->i_inode.i_nlink)
996 if (dip->i_entries == (u32)-1)
1011 error = gfs2_quota_lock_check(dip, &ap);
1015 error = gfs2_inplace_reserve(dip, &ap);
1019 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, &da, 2), 0);
1049 gfs2_inplace_release(dip);
1052 gfs2_quota_unlock(dip);
1059 gfs2_qa_put(dip);
1067 * @dip: the directory
1071 * Assumes that the lock on (at least) @dip is held.
1076 static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1084 if ((dip->i_inode.i_mode & S_ISVTX) &&
1085 !uid_eq(dip->i_inode.i_uid, current_fsuid()) &&
1089 if (IS_APPEND(&dip->i_inode))
1092 error = gfs2_permission(&nop_mnt_idmap, &dip->i_inode,
1097 return gfs2_dir_check(&dip->i_inode, name, ip);
1102 * @dip: The parent directory
1111 static int gfs2_unlink_inode(struct gfs2_inode *dip,
1118 error = gfs2_dir_del(dip, dentry);
1148 struct gfs2_inode *dip = GFS2_I(dir);
1162 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
1194 error = gfs2_unlink_ok(dip, &dentry->d_name, ip);
1202 error = gfs2_unlink_inode(dip, dentry);